Commit graph

112466 commits

Author SHA1 Message Date
Yuxin Wu fc44b8136f
[doc] Add a note in howto/logging.rst about "do not log to root logger in libraries" (GH-31271) 2022-02-26 18:29:51 +00:00
Kumar Aditya 0d9b565e62
Propagate errors (however unlikely) from _Py_Deepfreeze_Init() (GH-31596) 2022-02-26 08:35:03 -08:00
Tin Tvrtković edbee56d69
Taskgroup tweaks (GH-31559)
Now uses .cancel()/.uncancel(), for even fewer broken edge cases.
2022-02-26 08:18:48 -08:00
Kumar Aditya 41ddcd3f40
bpo-44011: Document ssl_shutdown_timeout added by revisited asyncio SSL implementation (GH-31597) 2022-02-26 15:06:43 +02:00
Thomas Grainger b57dbe5d1b
bpo-38415: Remove redundant AsyncContextDecorator.__call__ override from _AsyncGeneratorContextManager (GH-30233) 2022-02-26 14:05:20 +02:00
Charlie Zhao e466faa9df
bpo-45735: Promise the long-time truth that args=list works (GH-30982)
For threads, and for multiprocessing, it's always been the case that ``args=list`` works fine when passed to ``Process()`` or ``Thread()``, and such code is common in the wild. But, according to the docs, only a tuple can be used. This brings the docs into synch with reality.

Doc changes by Charlie Zhao.
Co-authored-by: Tim Peters <tim.peters@gmail.com>
2022-02-25 22:17:13 -06:00
Victor Stinner 5ab745fc51
bpo-46852: Remove the float.__set_format__() method (GH-31585)
Remove the undocumented private float.__set_format__() method,
previously known as float.__set_format__() in Python 3.7. Its
docstring said: "You probably don't want to use this function. It
exists mainly to be used in Python's test suite."
2022-02-26 00:53:27 +01:00
Oleg Iarygin 4060111f9d
bpo-46816: Remove declarations for non-__STDC__ compilers (GH-31466)
After Python switched to C11, there is a guarantee that every compiler
conforms to ISO C so checks of __STDC__ have no sense.
2022-02-26 00:16:59 +01:00
Kumar Aditya eb002dbe0d
bpo-46712: Share global string identifiers in deepfreeze (GH-31261)
Where appropriate, deepfreeze.c now uses `&_Py_ID(blah)` references instead of locally defining constants. This saves some space.
2022-02-25 10:05:24 -08:00
Victor Stinner ea9612a17b
bpo-46857: Fix test_embed.test_no_memleak() on Windows (GH-31589)
Tolerate a leak of 1 reference and 1 memory block until it's fixed.
2022-02-25 18:24:25 +01:00
Kumar Aditya dd69f73421
bpo-26897: Clarify Popen stdin, stdout, stderr file object docs (GH-30231) 2022-02-25 08:41:19 -08:00
Victor Stinner 87af12bff3
bpo-46836: Rename InterpreterFrame to _PyInterpreterFrame (GH-31583)
Rename also struct _interpreter_frame to struct _PyInterpreterFrame.

Reduce risk of name conflicts if a project includes pycore_frame.h.
2022-02-25 16:22:00 +01:00
Victor Stinner f780d9690f
bpo-45316: Move _PyArg_Fini() to internal C API (GH-31580)
Move the private unexported _PyArg_Fini() function to the internal C
API: to the pycore_pylifecycle.h header file.
2022-02-25 16:19:30 +01:00
Victor Stinner 8f2a337a80
bpo-45316: Move private functions to internal C API (GH-31579)
Move the unexported private functions to the internal C API:

* pycore_frame.h: _PyFrame_New_NoTrack()
* pycore_function.h: _PyFunction_GetVersionForCurrentState()
* pycore_genobject.h: _PyAsyncGenValueWrapperNew()
* pycore_genobject.h: _PyCoro_GetAwaitableIter()
* pycore_genobject.h: _PyGen_yf()
2022-02-25 16:07:14 +01:00
Raymond Hettinger 26aba295a9
Update dict/OrderedDict differences with code equivalents. (GH-31563) 2022-02-25 08:49:53 -06:00
Victor Stinner 8ddbdd9e96
bpo-45316: Move private PyDict functions to internal C API (GH-31577)
Move the following private unexported functions to the internal C API
headers:

* _PyDictKeys_GetVersionForCurrentState()
* _PyDictKeys_StringLookup()
* _PyDict_FromKeys()
* _PyDict_GetItemHint()
* _PyDict_KeysSize()
* _PyDict_LoadGlobal()
* _PyDict_NewKeysForClass()
* _PyDict_Pop_KnownHash()
* _PyDict_SetItem_Take2()
* _PyObjectDict_SetItem()
* _PyObject_MakeDictFromInstanceAttributes()
* _Py_dict_lookup()
2022-02-25 15:41:55 +01:00
Victor Stinner 4a0c7a1aac
bpo-45316: Move private PyCode C API to internal C API (GH-31576)
Rename private functions (no exported), add an underscore prefix:

* PyLineTable_InitAddressRange() => _PyLineTable_InitAddressRange()
* PyLineTable_NextAddressRange() => _PyLineTable_NextAddressRange()
* PyLineTable_PreviousAddressRange() => _PyLineTable_PreviousAddressRange()

Move private functions to the internal C API:

* _PyCode_Addr2EndLine()
* _PyCode_Addr2EndOffset()
* _PyCode_Addr2Offset()
* _PyCode_InitAddressRange()
* _PyCode_InitEndAddressRange(
* _PyLineTable_InitAddressRange()
* _PyLineTable_NextAddressRange()
* _PyLineTable_PreviousAddressRange()

No longer export the following internal functions:

* _PyCode_GetVarnames()
* _PyCode_GetCellvars()
* _PyCode_GetFreevars()
* _Py_GetSpecializationStats()

Add "extern" to pycore_code.h functions to identify them more easiliy
(they are still not exported).
2022-02-25 15:41:32 +01:00
Irit Katriel c579243eb6
bpo-46808: remove NEXT_BLOCK() from compile.c (GH-31448) 2022-02-25 12:17:50 +00:00
Brandt Bucher 0f41aac109
bpo-46841: Use *inline* caching for BINARY_OP (GH-31543) 2022-02-25 12:11:34 +00:00
Victor Stinner 18b5dd68c6
bpo-46836: Move PyFrameObject to pycore_frame.h (GH-31530)
Move the PyFrameObject type definition (struct _frame) to the
internal C API pycore_frame.h header file.
2022-02-25 12:53:19 +01:00
Victor Stinner 4657bf7016
bpo-1635741: Fix winreg reference leaks (GH-31560)
Clear also the PyHKEY_Type static type at exit.
2022-02-25 12:34:00 +01:00
Serhiy Storchaka e2e72567a1
bpo-46756: Fix authorization check in urllib.request (GH-31353)
Fix a bug in urllib.request.HTTPPasswordMgr.find_user_password() and
urllib.request.HTTPPasswordMgrWithPriorAuth.is_authenticated() which
allowed to bypass authorization. For example, access to URI "example.org/foobar"
was allowed if the user was authorized for URI "example.org/foo".
2022-02-25 13:31:03 +02:00
slateny 53ecf9e08d
bpo-34429: Noted TemporaryFile behavior on non-Posix/non-Cygwin systems (GH-31547) 2022-02-25 11:07:52 +00:00
Petr Viktorin 2c228a7b8f
bpo-46748: Don't import <stdbool.h> in public headers (GH-31553)
<stdbool.h> is the standard/modern way to define embedd/extends Python free to define bool, true and false, but there are existing applications that use slightly different redefinitions, which fail if the header is included.

It's OK to use stdbool outside the public headers, though.

https://bugs.python.org/issue46748
2022-02-25 09:25:54 +01:00
Serhiy Storchaka 98c3bea4d1
bpo-46820: Refactor tests for ambiguous end of numerical literal (GH-31494) 2022-02-25 10:25:12 +02:00
Inada Naoki ad6c7003e3
bpo-46606: Remove redundant +1. (GH-31561) 2022-02-25 14:13:14 +09:00
Victor Stinner 7d03c8be5a
bpo-46852: Rename float.__set_format__() to float.__setformat__() (GH-31558)
Rename the private undocumented float.__set_format__() method to
float.__setformat__() to fix a typo introduced in Python 3.7. The
method is only used by test_float.

The change enables again test_float tests on the float format which
were previously skipped because of the typo.

The typo was introduced in Python 3.7 by bpo-20185
in commit b5c51d3dd9.
2022-02-25 03:05:25 +01:00
Victor Stinner 1b2611eb02
bpo-46656: Remove Py_NO_NAN macro (GH-31160)
Building Python now requires support for floating point Not-a-Number
(NaN): remove the Py_NO_NAN macro.
2022-02-25 01:32:57 +01:00
Victor Stinner 5f8b5e2f21
bpo-46656: Building Python now requires a C11 compiler (GH-31557)
See PEP 7:
https://python.github.io/peps/pep-0007/#c-dialect
2022-02-25 01:31:30 +01:00
Victor Stinner 9475dc0b8d
bpo-46623: Skip two test_zlib tests on s390x (GH-31096)
Skip test_pair() and test_speech128() of test_zlib on s390x since
they fail if zlib uses the s390x hardware accelerator.
2022-02-25 00:32:02 +01:00
Victor Stinner c9c178fdb1
bpo-1635741: test_embed cheks that Python does not leak (GH-31555) 2022-02-25 00:03:20 +01:00
Christian Heimes 38f331d465
bpo-45898: Remove duplicate symbols from _ctypes/cfield.c (GH-29791) 2022-02-24 20:51:57 +01:00
Mark Shannon 2a6ece572c
bpo-45107: Specialize LOAD_METHOD for instances with dict. (GH-31531) 2022-02-24 19:34:57 +00:00
Kumar Aditya 4dc746310b
bpo-46430: Fix memory leak in interned strings of deep-frozen modules (GH-31549) 2022-02-24 17:54:06 +01:00
Victor Stinner 042f31da55
bpo-45459: C API uses type names rather than structure names (GH-31528)
Thanks to the new pytypedefs.h, it becomes to use type names like
PyObject rather like structure names like "struct _object".
2022-02-24 17:51:59 +01:00
Victor Stinner ec091bd47e
bpo-45459: Add pytypedefs.h header file (GH-31527)
Move forward declarations of Python C API types to a new pytypedefs.h
header file to solve interdependency issues between header files.

pytypedefs.h contains forward declarations of the following types:

* PyCodeObject
* PyFrameObject
* PyGetSetDef
* PyInterpreterState
* PyLongObject
* PyMemberDef
* PyMethodDef
* PyModuleDef
* PyObject
* PyThreadState
* PyTypeObject
2022-02-24 17:07:12 +01:00
Dennis Sweeney a52d2528a4
bpo-46823: Implement LOAD_FAST__LOAD_ATTR_INSTANCE_VALUE superinstruction (GH-31484) 2022-02-24 14:55:59 +00:00
Victor Stinner 4fccf91073
bpo-46659: Enhance LocaleTextCalendar for C locale (GH-31214)
If the LC_TIME locale is "C", use the user preferred locale.
2022-02-24 14:29:08 +01:00
Mark Shannon ae3adbeaed
Add (undocumented) _co_quickened attribute for code object. (GH-31552) 2022-02-24 12:10:53 +00:00
Tin Tvrtković 7fce1063b6
bpo-46771: Implement task cancel requests counter (GH-31513)
This changes cancelling() and uncancel() to return the count of pending cancellations.

This can be used to avoid bugs in certain edge cases (e.g. two timeouts going off at the same time).
2022-02-23 18:17:00 -08:00
dependabot[bot] 6e117e75c3
build(deps): bump actions/upload-artifact from 2.2.4 to 2.3.1 (GH-30325)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2.2.4 to 2.3.1.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v2.2.4...v2.3.1)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-23 23:16:47 +02:00
Victor Stinner 8a716bc62c
bpo-40421: What's New in Python 3.11: PyFrameObject.f_lasti (GH-31536)
Suggest replacing PyCode_Addr2Line() with PyFrame_GetLineNumber().
2022-02-23 20:20:03 +01:00
Brandt Bucher 281ea9c391
bpo-44337: Shrink the LOAD_ATTR/STORE_ATTR caches (GH-31517) 2022-02-23 10:53:24 -08:00
Victor Stinner 78859e58e4
bpo-40421: Fix PyFrame_GetCode() documentation (GH-31535)
Fix PyFrame_GetBack() and PyFrame_GetCode() return type in
the documentation.
2022-02-23 19:49:21 +01:00
Dong-hee Na 0bb40a42d7
closes bpo-46736: SimpleHTTPRequestHandler now uses HTML5. (GH-31533)
Co-authored-by: Oleg Iarygin <dralife@yandex.ru>
2022-02-23 09:59:32 -08:00
Victor Stinner 9bbdde2180
bpo-45412: Add _PY_SHORT_FLOAT_REPR macro (GH-31171)
Remove the HAVE_PY_SET_53BIT_PRECISION macro (moved to the internal
C API).

* Move HAVE_PY_SET_53BIT_PRECISION macro to pycore_pymath.h.
* Replace PY_NO_SHORT_FLOAT_REPR macro with _PY_SHORT_FLOAT_REPR
  macro which is always defined. gcc -Wundef emits a warning when
  using _PY_SHORT_FLOAT_REPR but the macro is not defined, if
  pycore_pymath.h include was forgotten.
2022-02-23 18:16:23 +01:00
Brandt Bucher 375a56bd40
bpo-45885: Don't un-adapt COMPARE_OP when collecting stats (GH-31516) 2022-02-23 11:06:25 +00:00
Brandt Bucher 424023efee
bpo-46329: Fix test failure when Py_STATS is enabled (GH-31511) 2022-02-23 11:00:28 +00:00
Eric V. Smith 288af845a3
bpo-46757: Add a test to verify dataclass's __post_init__ isn't being automatically added. (GH-31523) 2022-02-23 00:14:35 -05:00
Jelle Zijlstra 43cf44ddcc
Minor fixes to C API docs (GH-31501)
* C API docs: move PyErr_SetImportErrorSubclass docs

It was in the section about warnings, but it makes more sense to
put it with PyErr_SetImportError.

* C API docs: document closeit argument to PyRun_AnyFileExFlags

It was already documented for PyRun_SimpleFileExFlags.

* textual fixes to unicode docs

* Move paragraph about tp_dealloc into tp_dealloc section

* __aiter__ returns an async iterator, not an awaitable
2022-02-22 20:34:17 -08:00