Skip to content
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

Merged main into regmachine branch #50

Merged
merged 75 commits into from
Dec 28, 2022
Merged
Changes from 1 commit
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
1cf3d78
Correct CVE-2020-10735 documentation (#100306)
ucodery Dec 18, 2022
532aa4e
gh-94912: Added marker for non-standard coroutine function detection …
carltongibson Dec 18, 2022
702a5bc
Docs: Don't upload CI artifacts (#100330)
hugovk Dec 19, 2022
797edb2
gh-89727: Fix os.walk RecursionError on deep trees (#99803)
jonburdo Dec 19, 2022
36a0b1d
gh-69929: re docs: Add more specific definition of \w (#92015)
slateny Dec 20, 2022
79ccc03
gh-89051: Add ssl.OP_LEGACY_SERVER_CONNECT (#93927)
graingert Dec 20, 2022
39dfbb2
gh-88211: Change lower-case and upper-case to match recommendations i…
tbwolfe Dec 20, 2022
a6331b6
gh-100348: Fix ref cycle in `asyncio._SelectorSocketTransport` with `…
rkojedzinszky Dec 20, 2022
d98ca81
gh-99925: Fix inconsistency in `json.dumps()` error messages (GH-99926)
fnesveda Dec 20, 2022
cb60b61
Clarify that every thread has its own default context in contextvars …
pablogsal Dec 20, 2022
44892d4
gh-99576: Fix cookiejar file that was not truncated for some classes …
sobolevn Dec 20, 2022
c18d831
gh-100188: Reduce misses in BINARY_SUBSCR_(LIST/TUPLE)_INT (#100189)
sweeneyde Dec 20, 2022
a2bb3b7
gh-99991: improve docs on str.encode and bytes.decode (#100198)
bizzyvinci Dec 21, 2022
c615286
gh-91081: Add note on WeakKeyDictionary behavior when deleting a repl…
slateny Dec 21, 2022
79311cb
gh-85267: Improvements to inspect.signature __text_signature__ handli…
hauntsaninja Dec 21, 2022
4994f24
GH-100363: Speed up `asyncio.get_running_loop` (#100364)
kumaraditya303 Dec 21, 2022
a7715cc
GH-100133: fix `asyncio` subprocess losing `stderr` and `stdout` outp…
kumaraditya303 Dec 21, 2022
12be23c
gh-100374: Fixed a bug in socket.getfqdn() (gh-100375)
MTAwsl Dec 21, 2022
b98d2d3
gh-100129: Add tests for pickling all builtin types and functions (GH…
serhiy-storchaka Dec 21, 2022
e0b4d96
Remove unused variable from `dis._find_imports` (#100396)
sobolevn Dec 21, 2022
d713c54
gh-78878: Fix crash when creating an instance of `_ctypes.CField` (#1…
shihai1991 Dec 21, 2022
bbf4a66
GH-69564: Clarify use of octal format of mode argument in help(os.chm…
amaajemyfren Dec 21, 2022
3c033a2
GH-99554: Pack location tables more effectively (GH-99556)
brandtbucher Dec 22, 2022
6898157
Correct typo in typing.py (#100423)
david-why Dec 22, 2022
2b82c36
gh-99761: Add `_PyLong_IsPositiveSingleDigit` function to check for s…
eendebakpt Dec 22, 2022
a021612
GH-99770: Make the correct call specialization fail kind show up in t…
penguin-wwy Dec 22, 2022
aa878f0
gh-78997: fix bad rebase of moved test file (#100424)
eli-schwartz Dec 22, 2022
4cc63e0
gh-100344: Add C implementation for `asyncio.current_task` (#100345)
itamaro Dec 22, 2022
09edde9
GH-99554: Trim trailing whitespace (GH-100435)
brandtbucher Dec 22, 2022
9cdb642
gh-85432: Harmonise parameter names between C and pure-Python impleme…
AlexWaygood Dec 22, 2022
ad23da0
gh-57762: fix misleading tkinter.Tk docstring (#98837)
hauntsaninja Dec 22, 2022
f3db68e
gh-48496: Added example and link to faq for UnboundLocalError in refe…
slateny Dec 22, 2022
73c08ee
Fix typo in 3.12 What's New (#100449)
hauntsaninja Dec 23, 2022
84bc6a4
gh-76963: PEP3118 itemsize of an empty ctypes array should not be 0 (…
eric-wieser Dec 23, 2022
2659036
GH-100459: fix copy-paste errors in specialization stats (GH-100460)
iritkatriel Dec 23, 2022
88d565f
gh-99110: Initialize `frame->previous` in init_frame to fix segmentat…
byllyfish Dec 23, 2022
49f6ff7
gh-98712: Clarify "readonly bytes-like object" semantics in C arg-par…
encukou Dec 23, 2022
7fc7909
gh-92216: improve performance of `hasattr` for type objects (GH-99979)
eendebakpt Dec 23, 2022
c3c7848
gh-100288: Specialise LOAD_ATTR_METHOD for managed dictionaries (GH-1…
Fidget-Spinner Dec 23, 2022
36d3583
Revert "gh-100288: Specialise LOAD_ATTR_METHOD for managed dictionari…
Fidget-Spinner Dec 23, 2022
a98d9ea
gh-94155: Reduce hash collisions for code objects (#100183)
sweeneyde Dec 23, 2022
c5726b7
gh-83076: 3.8x speed improvement in (Async)Mock instantiation (#100252)
carljm Dec 23, 2022
745545b
gh-99482: remove `jython` compatibility parts from stdlib and tests (…
sobolevn Dec 23, 2022
1ecfd1e
bpo-40447: accept all path-like objects in compileall.compile_file (#…
FFY00 Dec 23, 2022
5d84966
GH-100425: Improve accuracy of builtin sum() for float inputs (GH-100…
rhettinger Dec 23, 2022
a68e585
gh-68320, gh-88302 - Allow for private `pathlib.Path` subclassing (GH…
barneygale Dec 23, 2022
474220e
gh-99947: Ensure unreported errors are chained for SystemError during…
seberg Dec 23, 2022
f89de67
Add "strict" to dotproduct(). Add docstring. Factor-out common code. …
rhettinger Dec 23, 2022
7ca45e5
gh-94808: improve test coverage of number formatting (#99472)
sobolevn Dec 24, 2022
a23cb72
gh-100454: Start running SSL tests with OpenSSL 3.1.0-beta1 (#100456)
illia-v Dec 24, 2022
3e46f9f
gh-100268: Add is_integer method to int (#100439)
hauntsaninja Dec 24, 2022
0f64206
gh-77771: Add enterabs example in sched (#92716)
slateny Dec 24, 2022
c122390
GH-91166: Implement zero copy writes for `SelectorSocketTransport` in…
kumaraditya303 Dec 24, 2022
2eea959
GH-91166: Implement zero copy writes for `SelectorSocketTransport` in…
kumaraditya303 Dec 24, 2022
0769f95
Misc Itertools recipe tweaks (GH-100493)
rhettinger Dec 24, 2022
bdfb694
gh-100357: Convert several functions in `bltinsmodule` to AC (#100358)
sobolevn Dec 24, 2022
c6dac12
Remove wrong comment about `repr` in `test_unicode` (#100495)
sobolevn Dec 24, 2022
00afa50
gh-99908: Tutorial: Modernize the 'data-record class' example (#100499)
JosephSBoyle Dec 24, 2022
46e6a28
gh-100474: Fix handling of dirs named index.html in http.server (GH-1…
Fraetor Dec 24, 2022
e4b43eb
gh-100287: Fix unittest.mock.seal with AsyncMock (#100496)
hauntsaninja Dec 24, 2022
f5b7b19
gh-99535: Add test for inheritance of annotations and update document…
MonadChains Dec 24, 2022
2e1a9ce
gh-100428: Make float documentation more accurate (#100437)
hauntsaninja Dec 24, 2022
efccd04
[Minor PR] Quotes in documentation changed into code blocks (#99536)
bartbroere Dec 24, 2022
046cbc2
gh-100472: Fix docs claim that compileall parameters could be bytes (…
hauntsaninja Dec 24, 2022
b9aa14a
gh-100519: simplification to `eff_request_host` in cookiejar.py (#99588)
glyph Dec 25, 2022
dbc1e69
gh-99308: Clarify re docs for byte pattern group names (#99311)
Kentzo Dec 25, 2022
ad3c99e
gh-92446: Improve argparse choices docs; revert bad change to lzma do…
yourlefthandman Dec 26, 2022
3ccc98f
Fix name of removed `inspect.Signature.from_builtin` method in 3.11.0…
Jackenmen Dec 26, 2022
199507b
gh-100520: Fix `rst` markup in `configparser` docstrings (#100524)
sobolevn Dec 26, 2022
ce39aaf
gh-99509: Add `__class_getitem__` to `multiprocessing.queues.Queue` (…
sobolevn Dec 27, 2022
b3da698
gh-94603: micro optimize list.pop (gh-94604)
eendebakpt Dec 27, 2022
b0ea289
Remove `NoneType` redefinition from `clinic.py` (#100551)
sobolevn Dec 27, 2022
3dc48da
gh-100553: Improve accuracy of sqlite3.Row iter test (#100555)
sobolevn Dec 28, 2022
08e5594
GH-98831: Modernize a ton of simpler instructions (#100545)
gvanrossum Dec 28, 2022
b8b8250
Merge remote-tracking branch 'origin/main' into regmachine
gvanrossum Dec 28, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
pythongh-94808: improve test coverage of number formatting (python#99472
)
  • Loading branch information
sobolevn authored Dec 24, 2022
commit 7ca45e5ddd493411e61706d07679ea54b954e41b
44 changes: 39 additions & 5 deletions Lib/test/test_unicode.py
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,20 @@ def __repr__(self):
self.assertRaises(ValueError, ("{" + big + "}").format)
self.assertRaises(ValueError, ("{[" + big + "]}").format, [0])

# test number formatter errors:
self.assertRaises(ValueError, '{0:x}'.format, 1j)
self.assertRaises(ValueError, '{0:x}'.format, 1.0)
self.assertRaises(ValueError, '{0:X}'.format, 1j)
self.assertRaises(ValueError, '{0:X}'.format, 1.0)
self.assertRaises(ValueError, '{0:o}'.format, 1j)
self.assertRaises(ValueError, '{0:o}'.format, 1.0)
self.assertRaises(ValueError, '{0:u}'.format, 1j)
self.assertRaises(ValueError, '{0:u}'.format, 1.0)
self.assertRaises(ValueError, '{0:i}'.format, 1j)
self.assertRaises(ValueError, '{0:i}'.format, 1.0)
self.assertRaises(ValueError, '{0:d}'.format, 1j)
self.assertRaises(ValueError, '{0:d}'.format, 1.0)

# issue 6089
self.assertRaises(ValueError, "{0[0]x}".format, [None])
self.assertRaises(ValueError, "{0[0](10)}".format, [None])
Expand Down Expand Up @@ -1541,11 +1555,31 @@ def __int__(self):
self.assertEqual('%X' % letter_m, '6D')
self.assertEqual('%o' % letter_m, '155')
self.assertEqual('%c' % letter_m, 'm')
self.assertRaisesRegex(TypeError, '%x format: an integer is required, not float', operator.mod, '%x', 3.14),
self.assertRaisesRegex(TypeError, '%X format: an integer is required, not float', operator.mod, '%X', 2.11),
self.assertRaisesRegex(TypeError, '%o format: an integer is required, not float', operator.mod, '%o', 1.79),
self.assertRaisesRegex(TypeError, '%x format: an integer is required, not PseudoFloat', operator.mod, '%x', pi),
self.assertRaises(TypeError, operator.mod, '%c', pi),
self.assertRaisesRegex(TypeError, '%x format: an integer is required, not float', operator.mod, '%x', 3.14)
self.assertRaisesRegex(TypeError, '%X format: an integer is required, not float', operator.mod, '%X', 2.11)
self.assertRaisesRegex(TypeError, '%o format: an integer is required, not float', operator.mod, '%o', 1.79)
self.assertRaisesRegex(TypeError, '%x format: an integer is required, not PseudoFloat', operator.mod, '%x', pi)
self.assertRaisesRegex(TypeError, '%x format: an integer is required, not complex', operator.mod, '%x', 3j)
self.assertRaisesRegex(TypeError, '%X format: an integer is required, not complex', operator.mod, '%X', 2j)
self.assertRaisesRegex(TypeError, '%o format: an integer is required, not complex', operator.mod, '%o', 1j)
self.assertRaisesRegex(TypeError, '%u format: a real number is required, not complex', operator.mod, '%u', 3j)
self.assertRaisesRegex(TypeError, '%i format: a real number is required, not complex', operator.mod, '%i', 2j)
self.assertRaisesRegex(TypeError, '%d format: a real number is required, not complex', operator.mod, '%d', 1j)
self.assertRaisesRegex(TypeError, '%c requires int or char', operator.mod, '%c', pi)

class RaisingNumber:
def __int__(self):
raise RuntimeError('int') # should not be `TypeError`
def __index__(self):
raise RuntimeError('index') # should not be `TypeError`

rn = RaisingNumber()
self.assertRaisesRegex(RuntimeError, 'int', operator.mod, '%d', rn)
self.assertRaisesRegex(RuntimeError, 'int', operator.mod, '%i', rn)
self.assertRaisesRegex(RuntimeError, 'int', operator.mod, '%u', rn)
self.assertRaisesRegex(RuntimeError, 'index', operator.mod, '%x', rn)
self.assertRaisesRegex(RuntimeError, 'index', operator.mod, '%X', rn)
self.assertRaisesRegex(RuntimeError, 'index', operator.mod, '%o', rn)

def test_formatting_with_enum(self):
# issue18780
Expand Down