Skip to content

Preserve valid composite inputs in global raise mode - #550

Open
rupayon123 wants to merge 1 commit into
python-validators:masterfrom
rupayon123:fix/nested-validation-raise-mode
Open

rupayon123 wants to merge 1 commit into
python-validators:masterfrom
rupayon123:fix/nested-validation-raise-mode

Conversation

@rupayon123

Copy link
Copy Markdown

With RAISE_VALIDATION_ERROR=True, hostname("127.0.0.1") and url("http://10.0.0.1") raise a domain error before their IP alternatives can run. Those inputs already pass with the documented r_ve=True call flag.

Apply the environment setting at the outermost validation call, so nested checks can return false validation errors and try alternatives. Explicit r_ve=True still raises inside nested calls. A context-local scope tracks the outer call’s lifetime, thread and current task; copied contexts cannot suppress later independent calls or calls in another thread/task. The scope is always expired and reset on exit. This keeps the existing synchronous decorator contract.

Regression coverage includes valid/invalid composite inputs, public error metadata, explicit nested flags, copied contexts after returns and exceptions, real worker threads, and normal/eager task inheritance. The full project tox list passes on macOS arm64: Ruff lint/format, strict Pyright, Bandit, 1,599 tests plus one feature-availability skip on Python 3.11.15, and all 1,600 tests on Python 3.12.15, 3.13.14 and 3.14.6. The project lockfile is unchanged. Other operating systems and release-only documentation/manpage exports were not run.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant