]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
2 years agogh-99815: remove unused 'invalid' sentinel value and code that checks for it in inspe...
Anthony Sottile [Sun, 27 Nov 2022 11:01:02 +0000 (06:01 -0500)] 
gh-99815: remove unused 'invalid' sentinel value and code that checks for it in inspect.signature parsing (GH-21104)

2 years agoGH-87235: Make sure "python /dev/fd/9 9</path/to/script.py" works on macOS (#99768)
Ronald Oussoren [Sun, 27 Nov 2022 10:56:14 +0000 (11:56 +0100)] 
GH-87235: Make sure "python /dev/fd/9 9</path/to/script.py" works on macOS (#99768)

On macOS all file descriptors for a particular file in /dev/fd
share the same file offset, that is ``open("/dev/fd/9", "r")`` behaves
more like ``dup(9)`` than a regular open.

This causes problems when a user tries to run "/dev/fd/9" as a script
because zipimport changes the file offset to try to read a zipfile
directory. Therefore change zipimport to reset the file offset after
trying to read the zipfile directory.

2 years agoRemove unused local variables in inspect.py (#24218)
Yonatan Goldschmidt [Sun, 27 Nov 2022 10:39:23 +0000 (12:39 +0200)] 
Remove unused local variables in inspect.py (#24218)

2 years agogh-85988: Change documentation for sys.float_info.rounds (GH-99675)
Brad Wolfe [Sun, 27 Nov 2022 10:25:12 +0000 (11:25 +0100)] 
gh-85988: Change documentation for sys.float_info.rounds (GH-99675)

* Change documentation for sys.float_info.rounds

Change the documentation for sys.float_info.rounds to remove
references to C99 section 5.2.4.2.2 and instead place the
available values inline.

* Correction to previous documentation change

Newlines were not preserved in generated HTML on previous
commit. I have changes the list to a comma-separated list
of values and their meanings.

* Clarify source for value of FLT_ROUNDS

Clarify the source of the FLT_ROUNDS value and
change 'floating-point addition' to 'floating-point
arithmetic' to indicate that the rounding mode
applies to all arithmetic operations.

2 years agodoc: Remove backslashes in doctest grammar docs (#29346)
George Zhang [Sun, 27 Nov 2022 06:38:39 +0000 (01:38 -0500)] 
doc: Remove backslashes in doctest grammar docs (#29346)

2 years agobpo-43327: Fix the docs for PyImport_ImportFrozenModuleObject() (#24659)
Zackery Spytz [Sun, 27 Nov 2022 06:27:41 +0000 (22:27 -0800)] 
bpo-43327: Fix the docs for PyImport_ImportFrozenModuleObject() (#24659)

The docs stated that PyImport_ImportFrozenModuleObject() returns a
new reference, but it actually returns an int.

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2 years agoGH-66285: fix forking in asyncio (#99769)
Kumar Aditya [Sun, 27 Nov 2022 05:54:48 +0000 (11:24 +0530)] 
GH-66285: fix forking in asyncio (#99769)

Closes #66285

2 years agobpo-45975: Simplify some while-loops with walrus operator (GH-29347)
Nick Drozd [Sat, 26 Nov 2022 22:33:25 +0000 (16:33 -0600)] 
bpo-45975: Simplify some while-loops with walrus operator (GH-29347)

2 years agogh-89682: [doc] reword docstring of __contains__ to clarify that it returns a bool...
Ivan Savov [Sat, 26 Nov 2022 22:24:04 +0000 (17:24 -0500)] 
gh-89682: [doc] reword docstring of __contains__ to clarify that it returns a bool (GH-29043)

2 years agogh-88330: Add more detail about what is a resource. (#99801)
Jason R. Coombs [Sat, 26 Nov 2022 21:57:20 +0000 (16:57 -0500)] 
gh-88330: Add more detail about what is a resource. (#99801)

2 years agogh-98108: Add limited pickleability to zipfile.Path (GH-98109)
Jason R. Coombs [Sat, 26 Nov 2022 18:05:41 +0000 (13:05 -0500)] 
gh-98108: Add limited pickleability to zipfile.Path (GH-98109)

* gh-98098: Move zipfile into a package.

* Moved test_zipfile to a package

* Extracted module for test_path.

* Add blurb

* Add jaraco as owner of zipfile.Path.

* Synchronize with minor changes found at jaraco/zipp@d9e7f4352d.

* gh-98108: Sync with zipp 3.9.1 adding pickleability.

2 years agogh-99795: Fix typo in importlib.resources.abc (GH-99796)
busywhitespace [Sat, 26 Nov 2022 18:01:08 +0000 (19:01 +0100)] 
gh-99795: Fix typo in importlib.resources.abc (GH-99796)

Changing TraversableReader to TraversableResources at one place of the documentation.

See #99795 for more details.

2 years agoFix zipfile packaging after GH-98103 (GH-99797)
Jason R. Coombs [Sat, 26 Nov 2022 18:00:05 +0000 (13:00 -0500)] 
Fix zipfile packaging after GH-98103 (GH-99797)

* Add zipfile and test_zipfile to list of packages. Fixes regression introduced in #98103.

* Restore support for py -m test.test_zipfile

2 years agogh-91078: Return None from TarFile.next when the tarfile is empty (GH-91850)
Sam Ezeh [Sat, 26 Nov 2022 17:57:05 +0000 (17:57 +0000)] 
gh-91078: Return None from TarFile.next when the tarfile is empty (GH-91850)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2 years agogh-98098: Create packages from zipfile and test_zipfile (gh-98103)
Jason R. Coombs [Sat, 26 Nov 2022 14:44:13 +0000 (09:44 -0500)] 
gh-98098: Create packages from zipfile and test_zipfile (gh-98103)

* gh-98098: Move zipfile into a package.

* Moved test_zipfile to a package

* Extracted module for test_path.

* Add blurb

* Add jaraco as owner of zipfile.Path.

* Synchronize with minor changes found at jaraco/zipp@d9e7f4352d.

2 years agogh-97966: Restore prior expectation that uname_result._fields and ._asdict would...
Jason R. Coombs [Sat, 26 Nov 2022 13:28:49 +0000 (08:28 -0500)] 
gh-97966: Restore prior expectation that uname_result._fields and ._asdict would include the processor. (gh-98343)

2 years agogh-99086: Fix -Wstrict-prototypes, -Wimplicit-function-declaration warnings in config...
Sam James [Sat, 26 Nov 2022 13:08:49 +0000 (13:08 +0000)] 
gh-99086: Fix -Wstrict-prototypes, -Wimplicit-function-declaration warnings in configure.ac (#99406)

Follow up to 12078e78f6e4a21f344e4eaff529e1ff3b97734f.

2 years agogh-99502: mention bytes-like objects as input in `secrets.compare_digest` (GH-99512)
Nikita Sobolev [Sat, 26 Nov 2022 09:33:48 +0000 (12:33 +0300)] 
gh-99502: mention bytes-like objects as input in `secrets.compare_digest` (GH-99512)

Now it is in sync with https://docs.python.org/3/library/hmac.html#hmac.compare_digest
It is the same function, just re-exported. So, I guess they should mention the same input types.

2 years agoGH-95896: posixmodule.c: fix osdefs.h inclusion to not depend on compiler (#95897)
TheShermanTanker [Sat, 26 Nov 2022 09:31:42 +0000 (17:31 +0800)] 
GH-95896: posixmodule.c: fix osdefs.h inclusion to not depend on compiler (#95897)

Co-authored-by: Steve Dower <steve.dower@python.org>
2 years agoFix typo in `__match_args__` doc (#99785)
Terry Jan Reedy [Sat, 26 Nov 2022 00:03:16 +0000 (19:03 -0500)] 
Fix typo in `__match_args__` doc (#99785)

A opy of #98549, whose author (@icecream17) uses a school computer that blocks the CLA site. I did not mention this in commit comment above so CLA bot does not pick up the name and request the CLA again.

2 years agogh-98724: Fix warnings on Py_SETREF() usage (#99781)
Victor Stinner [Fri, 25 Nov 2022 23:30:37 +0000 (00:30 +0100)] 
gh-98724: Fix warnings on Py_SETREF() usage (#99781)

Cast argument to the expected type.

2 years agogh-99029: Fix handling of `PureWindowsPath('C:\<blah>').relative_to('C:')` (GH-99031)
Barney Gale [Fri, 25 Nov 2022 19:15:57 +0000 (19:15 +0000)] 
gh-99029: Fix handling of `PureWindowsPath('C:\<blah>').relative_to('C:')` (GH-99031)

`relative_to()` now treats naked drive paths as relative. This brings its
behaviour in line with other parts of pathlib, and with `ntpath.relpath()`,
and so allows us to factor out the pathlib-specific implementation.

2 years agogh-64019: Have attribute table in `inspect` docs link to module attributes instead...
Stanley [Fri, 25 Nov 2022 19:10:22 +0000 (11:10 -0800)] 
gh-64019: Have attribute table in `inspect` docs link to module attributes instead of listing them (GH-98116)

Co-authored-by: Michael Anckaert <michael.anckaert@sinax.be>
2 years agoFix typo on inline comment for email.generator (GH-98210)
Gary Donovan [Fri, 25 Nov 2022 18:03:20 +0000 (05:03 +1100)] 
Fix typo on inline comment for email.generator (GH-98210)

Trivial change to comment - no issue or new entry necessary

2 years agobpo-40882: Fix a memory leak in SharedMemory on Windows (GH-20684)
Zackery Spytz [Fri, 25 Nov 2022 17:39:48 +0000 (09:39 -0800)] 
bpo-40882: Fix a memory leak in SharedMemory on Windows (GH-20684)

In multiprocessing.shared_memory.SharedMemory(), the temporary view
returned by MapViewOfFile() should be unmapped when it is no longer
needed.

2 years agogh-96168: Add sqlite3 row factory how-to (#99507)
Erlend E. Aasland [Fri, 25 Nov 2022 13:07:28 +0000 (14:07 +0100)] 
gh-96168: Add sqlite3 row factory how-to (#99507)

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2 years agobpo-38031: Fix a possible assertion failure in _io.FileIO() (#GH-5688)
Zackery Spytz [Fri, 25 Nov 2022 12:55:26 +0000 (04:55 -0800)] 
bpo-38031: Fix a possible assertion failure in _io.FileIO() (#GH-5688)

2 years agobpo-41260: C impl of datetime.date.strftime() takes different keyword arg (GH-21712)
Zackery Spytz [Fri, 25 Nov 2022 09:21:25 +0000 (01:21 -0800)] 
bpo-41260: C impl of datetime.date.strftime() takes different keyword arg (GH-21712)

2 years agoRevert "gh-98724: Fix Py_CLEAR() macro side effects" (#99737)
Victor Stinner [Thu, 24 Nov 2022 21:17:33 +0000 (22:17 +0100)] 
Revert "gh-98724: Fix Py_CLEAR() macro side effects" (#99737)

Revert "gh-98724: Fix Py_CLEAR() macro side effects (#99100)"

This reverts commit c03e05c2e72f3ea5e797389e7d1042eef85ad37a.

2 years agogh-64490: Fix bugs in argument clinic varargs processing (#32092)
colorfulappl [Thu, 24 Nov 2022 19:56:50 +0000 (03:56 +0800)] 
gh-64490: Fix bugs in argument clinic varargs processing (#32092)

2 years agoGH-66285: Revert "fix forking in asyncio" (#99756)
Kumar Aditya [Thu, 24 Nov 2022 17:34:21 +0000 (23:04 +0530)] 
GH-66285: Revert "fix forking in asyncio" (#99756)

2 years agoFix rendering of audioop license in Doc/license.rst (GH-99752)
Zachary Ware [Thu, 24 Nov 2022 16:18:40 +0000 (10:18 -0600)] 
Fix rendering of audioop license in Doc/license.rst (GH-99752)

Also some cosmetic blank line additions for consistency with the
formatting of the rest of the file.

2 years agoGH-66285: skip asyncio fork tests for platforms without md5 hash (#99745)
Kumar Aditya [Thu, 24 Nov 2022 16:06:06 +0000 (21:36 +0530)] 
GH-66285: skip asyncio fork tests for platforms without md5 hash  (#99745)

Such buildbots (at the time of writing, only "AMD64 RHEL8 FIPS Only Blake2 Builtin Hash 3.x") cannot use multiprocessing with a fork server, so just skip the test there.

2 years agoGH-79033: Fix asyncio.Server.wait_closed() (#98582)
Guido van Rossum [Thu, 24 Nov 2022 15:32:58 +0000 (07:32 -0800)] 
GH-79033: Fix asyncio.Server.wait_closed() (#98582)

It was a no-op when used as recommended (after close()).

I had to debug one test (test__sock_sendfile_native_failure) --
the cleanup sequence for the test fixture was botched.

Hopefully that's not a portend of problems in user code --
this has never worked so people may well be doing this wrong. :-(

Co-authored-by: kumar aditya
2 years agogh-99240: Fix double-free bug in Argument Clinic str_converter generated code (GH...
colorfulappl [Thu, 24 Nov 2022 14:01:26 +0000 (22:01 +0800)] 
gh-99240: Fix double-free bug in Argument Clinic str_converter generated code (GH-99241)

Fix double-free bug mentioned at https://github.com/python/cpython/issues/99240,
by moving memory clean up out of "exit" label.

Automerge-Triggered-By: GH:erlend-aasland
2 years agogh-64490: Fix refcount error when arguments are packed to tuple in argument clinic...
colorfulappl [Thu, 24 Nov 2022 12:24:18 +0000 (20:24 +0800)] 
gh-64490: Fix refcount error when arguments are packed to tuple in argument clinic (#99233)

2 years agogh-99708: fix bug where compiler crashes on if expression with an empty body block...
Irit Katriel [Thu, 24 Nov 2022 10:59:07 +0000 (10:59 +0000)] 
gh-99708: fix bug where compiler crashes on if expression with an empty body block (GH-99732)

2 years agogh-94808: [coverage] Add an asynchronous generator test where the generator is alread...
zhanpon [Thu, 24 Nov 2022 09:10:38 +0000 (18:10 +0900)] 
gh-94808: [coverage] Add an asynchronous generator test where the generator is already running (#97672)

2 years agogh-98872: Fix a possible resource leak in Python 3.11.0 (GH-99047)
SQLPATCH [Thu, 24 Nov 2022 09:04:19 +0000 (17:04 +0800)] 
gh-98872: Fix a possible resource leak in Python 3.11.0 (GH-99047)

Issue: #98872

Automerge-Triggered-By: GH:kumaraditya303
2 years agogh-99706: unicodeobject: Fix padding in `PyASCIIObject.state` (GH-99707)
David Hewitt [Thu, 24 Nov 2022 08:21:59 +0000 (08:21 +0000)] 
gh-99706: unicodeobject: Fix padding in `PyASCIIObject.state` (GH-99707)

2 years agoadd Kumar Aditya as `asyncio` codeowner (GH-99744)
Kumar Aditya [Thu, 24 Nov 2022 06:56:54 +0000 (12:26 +0530)] 
add Kumar Aditya as `asyncio` codeowner (GH-99744)

Automerge-Triggered-By: GH:kumaraditya303
2 years agoGH-66285: fix forking in `asyncio` (#99539)
Kumar Aditya [Thu, 24 Nov 2022 03:40:27 +0000 (09:10 +0530)] 
GH-66285: fix forking in `asyncio` (#99539)

`asyncio` now does not shares event loop and signal wakeupfd in forked processes.

2 years agogh-96828: Add an `ssl.OP_ENABLE_KTLS` option (GH-96830)
Illia Volochii [Thu, 24 Nov 2022 02:24:09 +0000 (04:24 +0200)] 
gh-96828: Add an `ssl.OP_ENABLE_KTLS` option (GH-96830)

Expose the constant when OpenSSL defines it.

2 years agocloses gh-99508: fix `TypeError` in `Lib/importlib/_bootstrap_external.py` (GH-99635)
Nikita Sobolev [Wed, 23 Nov 2022 22:47:31 +0000 (01:47 +0300)] 
closes gh-99508: fix `TypeError` in `Lib/importlib/_bootstrap_external.py` (GH-99635)

2 years agoUpload NEWS file as artifact (#30419)
Hugo van Kemenade [Wed, 23 Nov 2022 22:32:09 +0000 (00:32 +0200)] 
Upload NEWS file as artifact (#30419)

Co-authored-by: Éric <earaujo@caravan.coop>
2 years agoUse faster APIs to calculate paths at startup for Store packaged Python on Windows...
Steve Dower [Wed, 23 Nov 2022 19:50:15 +0000 (19:50 +0000)] 
Use faster APIs to calculate paths at startup for Store packaged Python on Windows (GH-99345)

2 years agogh-79315: Add Include/cpython/memoryobject.h header (#99723)
Victor Stinner [Wed, 23 Nov 2022 14:44:42 +0000 (15:44 +0100)] 
gh-79315: Add Include/cpython/memoryobject.h header (#99723)

Move non-limited C API from Include/memoryobject.h to a new
Include/cpython/memoryobject.h header file.

2 years agogh-99537: Use Py_SETREF(var, NULL) in C code (#99687)
Victor Stinner [Wed, 23 Nov 2022 13:57:50 +0000 (14:57 +0100)] 
gh-99537: Use Py_SETREF(var, NULL) in C code (#99687)

Replace "Py_DECREF(var); var = NULL;" with "Py_SETREF(var, NULL);".

2 years agogh-99619: fix error in documentation of ExceptionGroup.derive() (GH-99621)
Irit Katriel [Wed, 23 Nov 2022 10:59:52 +0000 (10:59 +0000)] 
gh-99619: fix error in documentation of ExceptionGroup.derive() (GH-99621)

2 years agoGH-95283: Add note about compilers in Mac/README.txt (#99506)
Ronald Oussoren [Wed, 23 Nov 2022 10:52:12 +0000 (11:52 +0100)] 
GH-95283: Add note about compilers in Mac/README.txt (#99506)

The build machinery assumes that the compiler that's used
to build on macOS includes an SDK that's at least as new
as the OS version on the build machine. Explicitly mention
this in Mac/README.txt.

2 years agoGH-98831: Add `macro` and `op` and their implementation to DSL (#99495)
Guido van Rossum [Wed, 23 Nov 2022 00:04:57 +0000 (16:04 -0800)] 
GH-98831: Add `macro` and `op` and their implementation to DSL (#99495)

Newly supported interpreter definition syntax:
- `op(NAME, (input_stack_effects -- output_stack_effects)) { ... }`
- `macro(NAME) = OP1 + OP2;`

Also some other random improvements:
- Convert `WITH_EXCEPT_START` to use stack effects
- Fix lexer to balk at unrecognized characters, e.g. `@`
- Fix moved output names; support object pointers in cache
- Introduce `error()` method to print errors
- Introduce read_uint16(p) as equivalent to `*p`

Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
2 years agogh-99300: Replace Py_INCREF() with Py_NewRef() in _elementtree.c (#99696)
Victor Stinner [Tue, 22 Nov 2022 21:17:06 +0000 (22:17 +0100)] 
gh-99300: Replace Py_INCREF() with Py_NewRef() in _elementtree.c (#99696)

* Replace Py_INCREF() and Py_XINCREF() using a cast with Py_NewRef()
  and Py_XNewRef() in Modules/_elementtree.c.
* Make reference counting more explicit: don't steal implicitly a
  reference on PyList_SET_ITEM(), use Py_NewRef() instead.
* Replace PyModule_AddObject() with PyModule_AddObjectRef().

2 years agogh-99650 : Updated argparse docs (GH-99653)
ram vikram singh [Tue, 22 Nov 2022 21:16:06 +0000 (02:46 +0530)] 
gh-99650 : Updated argparse docs (GH-99653)

2 years agogh-88226: Emit TARGET labels in Python/ceval.c when debugging, even if computed gotos...
Skip Montanaro [Tue, 22 Nov 2022 20:13:54 +0000 (14:13 -0600)] 
gh-88226: Emit TARGET labels in Python/ceval.c when debugging, even if computed gotos aren't enabled (GH-98265)

Keep target labels when debugging, but don't warn about lack of use.

Co-authored-by: Eryk Sun <eryksun@gmail.com>
2 years agogh-99146 struct module documentation should have more predictable examples/warnings...
Skip Montanaro [Tue, 22 Nov 2022 18:06:36 +0000 (12:06 -0600)] 
gh-99146 struct module documentation should have more predictable examples/warnings (GH-99141)

* nail down a couple examples to have more predictable output

* update a number of things, but this is really just a stash...

* added an applications section to describe typical uses for native and machine-independent formats

* make sure all format strings use a format prefix character

* responding to comments from @gpshead. Not likely finished yet.

* This got more involved than I expected...

* respond to several PR comments
* a lot of wordsmithing
* try and be more consistent in use of ``x`` vs ``'x'``
* expand examples a bit
* update the "see also" to be more up-to-date
* original examples relied on import * so present all examples as if

* reformat based on @gpshead comment (missed before)

* responding to comments

* missed this

* one more suggested edit

* wordsmithing

2 years agoUpdate Visual Studio solution to build all extension modules on F5 (GH-99667)
Steve Dower [Tue, 22 Nov 2022 17:20:47 +0000 (17:20 +0000)] 
Update Visual Studio solution to build all extension modules on F5 (GH-99667)

Without these "forward" dependencies, VS would only build as far as necessary to launch the selected project.

2 years agogh-99547: Add isjunction methods for checking if a path is a junction (GH-99548)
Charles Machalow [Tue, 22 Nov 2022 17:19:34 +0000 (09:19 -0800)] 
gh-99547: Add isjunction methods for checking if a path is a junction (GH-99548)

2 years agogh-99645: Fix a bug in handling class cleanups in unittest.TestCase (GH-99646)
Serhiy Storchaka [Tue, 22 Nov 2022 15:49:37 +0000 (17:49 +0200)] 
gh-99645: Fix a bug in handling class cleanups in unittest.TestCase (GH-99646)

Now addClassCleanup() uses separate lists for different TestCase subclasses,
and doClassCleanups() only cleans up the particular class.

2 years agogh-93937: Document PyFrame_Check and PyFrame_Type (GH-99695)
Petr Viktorin [Tue, 22 Nov 2022 15:41:57 +0000 (16:41 +0100)] 
gh-93937: Document PyFrame_Check and PyFrame_Type (GH-99695)

2 years agogh-88863: Clear ref cycles to resolve leak when asyncio.open_connection raises (...
Dong Uk, Kang [Tue, 22 Nov 2022 15:06:20 +0000 (00:06 +0900)] 
gh-88863: Clear ref cycles to resolve leak when asyncio.open_connection raises (#95739)

Break reference cycles to resolve memory leak, by
removing local exception and future instances from the frame

2 years agogh-99537: Use Py_CLEAR() function in C code (#99686)
Victor Stinner [Tue, 22 Nov 2022 14:22:55 +0000 (15:22 +0100)] 
gh-99537: Use Py_CLEAR() function in C code (#99686)

Replace "Py_XDECREF(var); var = NULL;" with "Py_CLEAR(var);".

Don't replace "Py_DECREF(var); var = NULL;" with "Py_CLEAR(var);". It
would add an useless "if (var)" test in code path where var cannot be
NULL.

2 years agogh-99537: Use Py_SETREF() function in C code (#99656)
Victor Stinner [Tue, 22 Nov 2022 13:22:22 +0000 (14:22 +0100)] 
gh-99537: Use Py_SETREF() function in C code (#99656)

Fix potential race condition in code patterns:

* Replace "Py_DECREF(var); var = new;" with "Py_SETREF(var, new);"
* Replace "Py_XDECREF(var); var = new;" with "Py_XSETREF(var, new);"
* Replace "Py_CLEAR(var); var = new;" with "Py_XSETREF(var, new);"

Other changes:

* Replace "old = var; var = new; Py_DECREF(var)"
  with "Py_SETREF(var, new);"
* Replace "old = var; var = new; Py_XDECREF(var)"
  with "Py_XSETREF(var, new);"
* And remove the "old" variable.

2 years agogh-99537: Use Py_SETREF() function in C code (#99657)
Victor Stinner [Tue, 22 Nov 2022 12:39:11 +0000 (13:39 +0100)] 
gh-99537: Use Py_SETREF() function in C code (#99657)

Fix potential race condition in code patterns:

* Replace "Py_DECREF(var); var = new;" with "Py_SETREF(var, new);"
* Replace "Py_XDECREF(var); var = new;" with "Py_XSETREF(var, new);"
* Replace "Py_CLEAR(var); var = new;" with "Py_XSETREF(var, new);"

Other changes:

* Replace "old = var; var = new; Py_DECREF(var)"
  with "Py_SETREF(var, new);"
* Replace "old = var; var = new; Py_XDECREF(var)"
  with "Py_XSETREF(var, new);"
* And remove the "old" variable.

2 years agogh-91053: Add an optional callback that is invoked whenever a function is modified...
mpage [Tue, 22 Nov 2022 12:06:44 +0000 (04:06 -0800)] 
gh-91053: Add an optional callback that is invoked whenever a function is modified (#98175)

2 years agogh-99537: Use Py_SETREF() function in longobject C code (#99655)
Victor Stinner [Tue, 22 Nov 2022 12:04:19 +0000 (13:04 +0100)] 
gh-99537: Use Py_SETREF() function in longobject C code (#99655)

Replace "Py_DECREF(var); var = new;" with "Py_SETREF(var, new);"
in longobject.c and _testcapi/long.c.

2 years agogh-99341: Cover type ignore nodes when incrementing line numbers (GH-99422)
Batuhan Taskaya [Tue, 22 Nov 2022 10:41:14 +0000 (13:41 +0300)] 
gh-99341: Cover type ignore nodes when incrementing line numbers (GH-99422)

2 years agoGH-92892: Add section about variadic functions to ctypes documentation (#99529)
Ronald Oussoren [Tue, 22 Nov 2022 10:33:37 +0000 (11:33 +0100)] 
GH-92892: Add section about variadic functions to ctypes documentation (#99529)

On some platforms, and in particular macOS/arm64, the calling
convention for variadic arguments is different from the regular
calling convention. Add a section to the documentation to document
this.

2 years agoGH-97001: Release GIL in termios extension (#99503)
Ronald Oussoren [Tue, 22 Nov 2022 10:14:23 +0000 (11:14 +0100)] 
GH-97001: Release GIL in termios extension (#99503)

Without releasing the GIL calls to termios APIs might block the entire interpreter.

2 years agogh-47146: Soft-deprecate structmember.h, expose its contents via Python.h (GH-99014)
Petr Viktorin [Tue, 22 Nov 2022 07:25:43 +0000 (08:25 +0100)] 
gh-47146: Soft-deprecate structmember.h, expose its contents via Python.h (GH-99014)

The ``structmember.h`` header is deprecated, though it continues to be available
and there are no plans to remove it. There are no deprecation warnings. Old code
can stay unchanged (unless the extra include and non-namespaced macros bother
you greatly). Specifically, no uses in CPython are updated -- that would just be
unnecessary churn.
The ``structmember.h`` header is deprecated, though it continues to be
available and there are no plans to remove it.

Its contents are now available just by including ``Python.h``,
with a ``Py`` prefix added if it was missing:

- `PyMemberDef`, `PyMember_GetOne` and`PyMember_SetOne`
- Type macros like `Py_T_INT`, `Py_T_DOUBLE`, etc.
  (previously ``T_INT``, ``T_DOUBLE``, etc.)
- The flags `Py_READONLY` (previously ``READONLY``) and
  `Py_AUDIT_READ` (previously all uppercase)

Several items are not exposed from ``Python.h``:

- `T_OBJECT` (use `Py_T_OBJECT_EX`)
- `T_NONE` (previously undocumented, and pretty quirky)
- The macro ``WRITE_RESTRICTED`` which does nothing.
- The macros ``RESTRICTED`` and ``READ_RESTRICTED``, equivalents of
  `Py_AUDIT_READ`.
- In some configurations, ``<stddef.h>`` is not included from ``Python.h``.
  It should be included manually when using ``offsetof()``.

The deprecated header continues to provide its original
contents under the original names.
Your old code can stay unchanged, unless the extra include and non-namespaced
macros bother you greatly.

There is discussion on the issue to rename `T_PYSSIZET` to `PY_T_SSIZE` or
similar. I chose not to do that -- users will probably copy/paste that with any
spelling, and not renaming it makes migration docs simpler.

Co-Authored-By: Alexander Belopolsky <abalkin@users.noreply.github.com>
Co-Authored-By: Matthias Braun <MatzeB@users.noreply.github.com>
2 years agogh-99662: fix typo in typing.TypeVarTuple docs (#99672)
GabrielAnguita [Tue, 22 Nov 2022 04:02:55 +0000 (01:02 -0300)] 
gh-99662: fix typo in typing.TypeVarTuple docs (#99672)

2 years agogh-99659: Use correct exceptions in sqlite3 bigmem tests (#99660)
Łukasz Langa [Mon, 21 Nov 2022 20:44:17 +0000 (21:44 +0100)] 
gh-99659: Use correct exceptions in sqlite3 bigmem tests (#99660)

The tests in question were added in 0eec6276fdcd by Serhiy. Apparently,
sqlite3 changed exceptions raised in those cases in the mean time but
the tests never ran because they require a high `-M` setting in the
test runner.

2 years agogh-98629: Fixes sys._git and sys.version creation on Windows (GH-99664)
Steve Dower [Mon, 21 Nov 2022 20:42:18 +0000 (20:42 +0000)] 
gh-98629: Fixes sys._git and sys.version creation on Windows (GH-99664)

2 years agogh-96002: Add functional test for Argument Clinic (#96178)
colorfulappl [Mon, 21 Nov 2022 14:08:45 +0000 (22:08 +0800)] 
gh-96002: Add functional test for Argument Clinic (#96178)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2 years agoAdd more details in test_unittest (GH-99626)
Serhiy Storchaka [Mon, 21 Nov 2022 11:57:30 +0000 (13:57 +0200)] 
Add more details in test_unittest (GH-99626)

2 years agogh-99578: Fix refleak in _imp.create_builtin() (#99642)
Victor Stinner [Mon, 21 Nov 2022 11:14:54 +0000 (12:14 +0100)] 
gh-99578: Fix refleak in _imp.create_builtin() (#99642)

Fix a reference bug in _imp.create_builtin() after the creation of
the first sub-interpreter for modules "builtins" and "sys".

2 years agoGH-95815: Document less specific error for os.remove (#99571)
Ronald Oussoren [Mon, 21 Nov 2022 10:08:06 +0000 (11:08 +0100)] 
GH-95815: Document less specific error for os.remove (#99571)

os.remove can raise PermissionError instead of IsADirectoryError,
when the object to be removed is a directory (in particular on
macOS).

This reverts a change done in #14262.

2 years agogh-99337: Fix compile errors with gcc 12 on macOS (#99470)
Ronald Oussoren [Mon, 21 Nov 2022 09:50:20 +0000 (10:50 +0100)] 
gh-99337: Fix compile errors with gcc 12 on macOS (#99470)

Fix a number of compile errors with GCC-12 on macOS:

1. In pylifecycle.c the compile rejects _Pragma within a declaration
2. posixmodule.c was missing a number of ..._RUNTIME macros for non-clang on macOS
3. _ctypes assumed that __builtin_available is always present on macOS

2 years agogh-90994: Improve error messages upon call arguments syntax errors (GH-96893)
Lysandros Nikolaou [Sun, 20 Nov 2022 23:15:05 +0000 (00:15 +0100)] 
gh-90994: Improve error messages upon call arguments syntax errors (GH-96893)

2 years agogh-99581: Fix a buffer overflow in the tokenizer when copying lines that fill the...
Pablo Galindo Salgado [Sun, 20 Nov 2022 20:20:03 +0000 (20:20 +0000)] 
gh-99581: Fix a buffer overflow in the tokenizer when copying lines that fill the available buffer (#99605)

2 years agogh-61460: Add a comment describing the multiprocessing.connection protocol (gh-99623)
Gregory P. Smith [Sun, 20 Nov 2022 18:20:04 +0000 (10:20 -0800)] 
gh-61460: Add a comment describing the multiprocessing.connection protocol (gh-99623)

Describe the multiprocessing connection protocol.

It isn't a good protocol, but it is what it is.  This way we can more
easily reason about making changes to it in a backwards compatible way.

2 years agogh-99211: Point to except/except* on syntax errors when mixing them (GH-99215)
Lysandros Nikolaou [Sun, 20 Nov 2022 17:11:02 +0000 (18:11 +0100)] 
gh-99211: Point to except/except* on syntax errors when mixing them (GH-99215)

Automerge-Triggered-By: GH:lysnikolaou
2 years agogh-99201: fix IndexError when initializing sysconfig config variables
Filipe Laíns [Sat, 19 Nov 2022 20:47:09 +0000 (20:47 +0000)] 
gh-99201: fix IndexError when initializing sysconfig config variables

2 years agoDoc: Make functions.html readable again. (GH-99476)
Julien Palard [Sat, 19 Nov 2022 10:25:45 +0000 (11:25 +0100)] 
Doc: Make functions.html readable again. (GH-99476)

2 years ago gh-99284: [ctypes] remove `_use_broken_old_ctypes_structure_semantics_` (GH-99285)
Nikita Sobolev [Sat, 19 Nov 2022 06:25:32 +0000 (09:25 +0300)] 
 gh-99284: [ctypes] remove `_use_broken_old_ctypes_structure_semantics_` (GH-99285)

It was untested and undocumented. No code has been found in the wild that ever used it.

2 years agogh-85073: Add some missing links to source (GH-99363)
Stanley [Fri, 18 Nov 2022 19:33:40 +0000 (11:33 -0800)] 
gh-85073: Add some missing links to source (GH-99363)

Add some missing links to source from Python docs

2 years agoDoc: Replace question mark with fullstop (#99558)
Rafael Fontenelle [Fri, 18 Nov 2022 19:24:23 +0000 (16:24 -0300)] 
Doc: Replace question mark with fullstop (#99558)

The sentence "Set the LC_CTYPE locale to the user preferred locale." should end with a period
instead of a question mark.

2 years agoDoc: Fix broken link to emscripten networking website (#99531)
Alexander Ryabov [Fri, 18 Nov 2022 18:57:04 +0000 (21:57 +0300)] 
Doc: Fix broken link to emscripten networking website (#99531)

There was an extra `>` in the url.

2 years agogh-99553: fix bug where an ExceptionGroup subclass can wrap a BaseException (GH-99572)
Irit Katriel [Fri, 18 Nov 2022 15:44:43 +0000 (15:44 +0000)] 
gh-99553: fix bug where an ExceptionGroup subclass can wrap a BaseException (GH-99572)

2 years agogh-99442: Fix handling in py.exe launcher when argv[0] does not include a file extens...
Steve Dower [Fri, 18 Nov 2022 14:14:56 +0000 (14:14 +0000)] 
gh-99442: Fix handling in py.exe launcher when argv[0] does not include a file extension (GH-99542)

2 years agoGH-98831: Refactor and fix cases generator (#99526)
Guido van Rossum [Fri, 18 Nov 2022 01:06:07 +0000 (17:06 -0800)] 
GH-98831: Refactor and fix cases generator (#99526)

Also complete cache effects for BINARY_SUBSCR family.

2 years agoGH-99298: Clean up attribute specializations (GH-99398)
Brandt Bucher [Thu, 17 Nov 2022 23:09:18 +0000 (15:09 -0800)] 
GH-99298: Clean up attribute specializations (GH-99398)

2 years agoGH-98686: Get rid of BINARY_OP_GENERIC and COMPARE_OP_GENERIC (GH-99399)
Brandt Bucher [Thu, 17 Nov 2022 19:36:57 +0000 (11:36 -0800)] 
GH-98686: Get rid of BINARY_OP_GENERIC and COMPARE_OP_GENERIC (GH-99399)

2 years agoAdd a macro for "inlining" new frames (GH-99490)
Brandt Bucher [Thu, 17 Nov 2022 19:36:03 +0000 (11:36 -0800)] 
Add a macro for "inlining" new frames (GH-99490)

2 years agoMisc copyedits in docs on built-in types (GH-24466)
Adorilson Bezerra [Thu, 17 Nov 2022 16:06:00 +0000 (16:06 +0000)] 
Misc copyedits in docs on built-in types (GH-24466)

# DOC: Improvements in library/stdtypes

This PR does the following:

1. Replaces :meth: by :func: around repr function
2. Adds links to Unicode Standard site
3. Makes explicit "when" you can call the `iskeyword` function. The previous text could cause confusion to readers, especially those with English as a second language. The reader could understand that the `isidentifier` method calls the `iskeyword` function. Now, it is explicit that the dev can do it.
4. Replaces a URL with an inline link.

Automerge-Triggered-By: GH:AlexWaygood
2 years agogh-93649: Split float/long tests from _testcapimodule.c (GH-99549)
Erlend E. Aasland [Thu, 17 Nov 2022 08:56:56 +0000 (09:56 +0100)] 
gh-93649: Split float/long tests from _testcapimodule.c (GH-99549)

Automerge-Triggered-By: GH:erlend-aasland
2 years agogh-99377: Revert audit events for thread state creation and free, because the GIL...
Steve Dower [Thu, 17 Nov 2022 00:24:16 +0000 (00:24 +0000)] 
gh-99377: Revert audit events for thread state creation and free, because the GIL is not properly held at these times (GH-99543)

2 years agogh-99443: `descr_set_trampoline_call` return type should be `int` not `PyObject*...
Hood Chatham [Wed, 16 Nov 2022 23:20:17 +0000 (15:20 -0800)] 
gh-99443: `descr_set_trampoline_call` return type should be `int` not `PyObject*` (#99444)

2 years agoRemove old comment (GH-99489)
Brandt Bucher [Wed, 16 Nov 2022 21:43:31 +0000 (13:43 -0800)] 
Remove old comment (GH-99489)

2 years agogh-99370: Prefer LIBDIR from sysconfig when locating libpython for test (GH-99523)
Steve Dower [Wed, 16 Nov 2022 21:41:13 +0000 (21:41 +0000)] 
gh-99370: Prefer LIBDIR from sysconfig when locating libpython for test (GH-99523)

2 years agogh-93649: Split watcher API tests from _testcapimodule.c (#99532)
Erlend E. Aasland [Wed, 16 Nov 2022 19:13:32 +0000 (20:13 +0100)] 
gh-93649: Split watcher API tests from _testcapimodule.c (#99532)