-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
bpo-43988: Add test.support.check_disallow_instantiation #25757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,7 @@ | |
"requires_IEEE_754", "requires_zlib", | ||
"anticipate_failure", "load_package_tests", "detect_api_mismatch", | ||
"check__all__", "skip_if_buggy_ucrt_strfptime", | ||
"check_disallow_instantiation", | ||
# sys | ||
"is_jython", "is_android", "check_impl_detail", "unix_shell", | ||
"setswitchinterval", | ||
|
@@ -1982,3 +1983,13 @@ def skip_if_broken_multiprocessing_synchronize(): | |
synchronize.Lock(ctx=None) | ||
except OSError as exc: | ||
raise unittest.SkipTest(f"broken multiprocessing SemLock: {exc!r}") | ||
|
||
|
||
def check_disallow_instantiation(testcase, tp, *args, **kwds): | ||
erlend-aasland marked this conversation as resolved.
Show resolved
Hide resolved
|
||
""" | ||
Helper for testing types with the Py_TPFLAGS_DISALLOW_INSTANTIATION flag. | ||
erlend-aasland marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
See bpo-43916. | ||
""" | ||
msg = f"cannot create '{tp.__module__}\.{tp.__name__}' instances" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should use f"xxx\.xxx" or fr"xxx.xxx". Or maybe use re.escape(). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since these tests are decorated with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about setting the match pattern depending on what |
||
testcase.assertRaisesRegex(TypeError, msg, tp, *args, **kwds) |
Uh oh!
There was an error while loading. Please reload this page.