Commit graph

12882 commits

Author SHA1 Message Date
Pablo Galindo Salgado 6d791a9736
gh-96143: Allow Linux perf profiler to see Python calls (GH-96123)
⚠️  ⚠️ Note for reviewers, hackers and fellow systems/low-level/compiler engineers ⚠️ ⚠️ 

If you have a lot of experience with this kind of shenanigans and want to improve the **first** version, **please make a PR against my branch** or **reach out by email** or **suggest code changes directly on GitHub**. 

If you have any **refinements or optimizations** please, wait until the first version is merged before starting hacking or proposing those so we can keep this PR productive.
2022-08-30 10:11:18 -07:00
TW 023c51d9d8
gh-69142: add %:z strftime format code (gh-95983)
datetime.isoformat generates the tzoffset with colons, but there
was no format code to make strftime output the same format.

for simplicity and consistency the %:z formatting behaves mostly
as %z, with the exception of adding colons. this includes the
dynamic behaviour of adding seconds and microseconds only when
needed (when not 0).

this fixes the still open "generate" part of this issue:

https://github.com/python/cpython/issues/69142

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-08-28 14:27:42 -07:00
Ansab Gillani 0ace820bec
fixes gh-96292: Fix Trivial Typo in cpython/Modules/atexitmodule.c (#96327) 2022-08-26 22:33:29 -07:00
Carl Friedrich Bolz-Tereick 9c197bc8bf
GH-96172 fix unicodedata.east_asian_width being wrong on unassigned code points (#96207) 2022-08-26 19:29:39 +03:00
Christian Heimes 8c1dbad36f
gh-96269: Fix build dependency on AIX (GH-96304) 2022-08-26 12:31:58 +02:00
Mark Shannon c09fa7542c
GH-96237: Allow non-functions as reference-holder in frames. (GH-96238) 2022-08-25 10:16:55 +01:00
Irit Katriel 420f39f457
gh-93678: add _testinternalcapi.optimize_cfg() and test utils for compiler optimization unit tests (GH-96007) 2022-08-24 11:02:53 +01:00
Carl Friedrich Bolz-Tereick 2d9f252c0c
gh-96019: Fix caching of decompositions in makeunicodedata (GH-96020) 2022-08-19 12:20:44 +03:00
Petr Viktorin 0f2b469ce1
gh-95991: Add some infrastructure for testing Limited API in _testcapi (GH-95992)
- Limited API needs to be enabled per source file
- Some builds don't support Limited API, so Limited API tests must be skipped on those builds
  (currently this is `Py_TRACE_REFS`, but that may change.)
- `Py_LIMITED_API` must be defined before `<Python.h>` is included.

This puts the hoop-jumping in `testcapi/parts.h`, so individual
test files can be relatively simple. (Currently that's only
`vectorcall_limited.c`, imagine more.)
2022-08-17 13:48:43 +02:00
Christian Heimes 48174fa0b9
gh-96005: Handle WASI ENOTCAPABLE in getpath (GH-96006)
- On WASI `ENOTCAPABLE` is now mapped to `PermissionError`.
- The `errno` modules exposes the new error number.
- `getpath.py` now ignores `PermissionError` when it cannot open landmark
  files `pybuilddir.txt` and `pyenv.cfg`.
2022-08-16 20:20:15 +02:00
Mark Shannon 5a8c15819c
GH-95245: Move weakreflist into the pre-header. (GH-95996) 2022-08-16 13:57:18 +01:00
Yury Selivanov b2afe482f2
gh-95808: Add missing early returns in _asynciomodule.c (#95809) 2022-08-15 16:32:40 -07:00
Christian Heimes 8621e6d43a
gh-95707: Fix function signature (GH-95995) 2022-08-15 15:06:28 +01:00
Mark Shannon 3ef3c6306d
GH-95707: Fix uses of Py_TPFLAGS_MANAGED_DICT (GH-95854)
* Make sure that tp_dictoffset is correct with Py_TPFLAGS_MANAGED_DICT is set.

* Avoid traversing managed dict twice when subclassing class with Py_TPFLAGS_MANAGED_DICT set.
2022-08-15 12:29:27 +01:00
Christian Heimes 4a7f5a55dc
gh-95853: Address wasm build and test issues (GH-95985) 2022-08-15 07:41:10 +02:00
Erlend E. Aasland f07adf82f3
gh-90928: Improve static initialization of keywords tuple in AC (#95907) 2022-08-13 12:09:40 +02:00
Eric Snow 6f6a4e6cc5
gh-90928: Statically Initialize the Keywords Tuple in Clinic-Generated Code (gh-95860)
We only statically initialize for core code and builtin modules.  Extension modules still create
the tuple at runtime.  We'll solve that part of interpreter isolation separately.

This change includes generated code. The non-generated changes are in:

* Tools/clinic/clinic.py
* Python/getargs.c
* Include/cpython/modsupport.h
* Makefile.pre.in (re-generate global strings after running clinic)
* very minor tweaks to Modules/_codecsmodule.c and Python/Python-tokenize.c

All other changes are generated code (clinic, global strings).
2022-08-11 15:25:49 -06:00
Christian Heimes 8b34e914bb
gh-95878: Fix format char in datetime CAPI tests (GH-95879) 2022-08-11 11:58:10 +02:00
Petr Viktorin 71c3d649b5
gh-95504: Fix negative numbers in PyUnicode_FromFormat (GH-95848)
Co-authored-by: philg314 <110174000+philg314@users.noreply.github.com>
2022-08-10 13:12:40 +02:00
Petr Viktorin 5a97a93be0
gh-93649: Undefine NDEBUG in Modules/_testcapi/* to enable assert() (GH-95793) 2022-08-10 11:53:10 +02:00
Petr Viktorin 325ae93b6b
gh-93649: Split unicode tests from _testcapimodule.c & add some more (GH-95819)
- Move PyUnicode tests to a separate file
- Add some more tests for PyUnicode_FromFormat

Co-authored-by: philg314 <110174000+philg314@users.noreply.github.com>
2022-08-10 09:10:25 +02:00
Petr Viktorin eb81c1aea1
Disable Limited API tests with Py_TRACE_REFS (GH-95796) 2022-08-09 09:03:11 +02:00
Petr Viktorin 656dad702d
gh-93274: Expose receiving vectorcall in the Limited API (GH-95717) 2022-08-08 14:12:05 +02:00
Erlend E. Aasland 0c14f07256
Fix downcast compiler warning in Modules/_testcapi/vectorcall.c (#95729) 2022-08-08 10:58:29 +02:00
Tim Gates 32b49f613a
docs: Fix a few typos (#94899)
- overriden => overridden
- calcualation => calculation

Signed-off-by: Tim Gates <tim.gates@iress.com>
2022-08-08 10:02:45 +02:00
Aivars Kalvāns 15f4a35487
gh-95385 Fastpath for encoding dict to JSON (gh-95374) 2022-08-06 15:55:24 +09:00
Eric Snow bdbadb905a
gh-94673: Recover Weaklist Lookup Performance (gh-95544)
gh-95302 seems to have introduced a small performance regression. Here we make some minor changes to recover that lost performance.
2022-08-04 11:28:15 -06:00
Serhiy Storchaka ab8a5beb5f
Fix links to old SF bugs (#95648) 2022-08-04 18:12:35 +02:00
Petr Viktorin 7b370b7305
gh-93274: Make vectorcall safe on mutable classes & inherit it by default (#95437) 2022-08-04 17:19:29 +02:00
Petr Viktorin a613fedd6e
gh-95388: Deprecate creating immutable types with mutable bases (GH-95533) 2022-08-04 16:13:45 +02:00
Ken Jin 42b102bbf9
gh-94936: C getters: co_varnames, co_cellvars, co_freevars (#95008) 2022-08-04 06:53:31 -07:00
Łukasz Langa 0342c93a6b
gh-91323: Revert "Allow overriding a future compliance check in asyncio.Task (GH-32197)" (GH-95442)
This reverts commit d4bb38f82b.
2022-08-04 15:51:38 +02:00
Serhiy Storchaka d0d0154443
gh-91838: Resolve HTTP links which redirect to HTTPS (GH-95642)
It updates links which redirect to HTTPS with different authority or
path.
2022-08-04 13:30:05 +03:00
Mark Shannon 906e450932
GH-92678: Fix tp_dictoffset inheritance. (GH-95596)
* Add test for inheriting explicit __dict__ and weakref.

* Restore 3.10 behavior for multiple inheritance of C extension classes that store their dictionary at the end of the struct.
2022-08-03 18:56:24 +01:00
Oleg Iarygin 858c9a58bf
gh-95417: Quick fix for "ULONG_PTR differs in levels of indirection from void *" (GH-95538) 2022-08-01 17:30:15 +01:00
Petr Viktorin 664e96a98f
gh-93649: Split heaptype tests from _testcapimodule.c (GH-95386)
This removes the unused negative_dictoffset function:
the type this function would create is available as
    _testcapi.HeapCTypeWithNegativeDict
2022-08-01 15:04:14 +02:00
Oleg Iarygin a739ee412c
gh-94512: Fix forced arg format in AC-processed resource (GH-94515) 2022-07-29 12:48:11 +01:00
Raghunandan Bhat edb72047f3
gh-43414: os.get_terminal_size() now uses the actual file descriptor on Windows instead of mapping to standard handles (#93203) 2022-07-28 23:48:33 +01:00
Oleg Iarygin 26d4af0ba5
gh-94512: Fix forced arg format in AC-processed overlapped (GH-94516) 2022-07-28 23:09:46 +01:00
Pablo Galindo Salgado f40bc7fa49
gh-95324: Emit a warning if an object doesn't call PyObject_GC_UnTrack during deallocation in debug mode (#95325) 2022-07-27 16:03:38 +01:00
Kumar Aditya 4dd099baff
GH-93899: fix checks for eventfd flags (GH-95170) 2022-07-27 06:05:29 -07:00
Kumar Aditya deacf391d7
GH-95045: gc untrack _lsprof.Profiler before deallocating it (GH-95315)
Automerge-Triggered-By: GH:pablogsal
2022-07-27 05:03:50 -07:00
Aivars Kalvāns 8c88e360e7
gh-95005: Replace PyAccu with PyUnicodeWriter (gh-95006) 2022-07-27 17:43:34 +09:00
Christian Heimes 8b24d60f1b
gh-95174: WASI: skip missing sockets functions (GH-95179) 2022-07-27 08:19:23 +02:00
Noam Cohen b1f648efc5
gh-95041: Fail syslog.syslog in case inner call to syslog.openlog fails (GH-95264) 2022-07-26 14:34:15 +03:00
Christian Heimes 0d35a59ce3
gh-95174: Handle missing dup() and constants in WASI (GH-95229)
- check for ``dup()`` libc function
- handle missing ``F_DUPFD`` in ``dup2()`` replacement function
- add workaround for WASI libc bug in MSG_TRUNC
- ESHUTDOWN is missing, use EPIPE instead
- POLLPRI is missing, define as 0 (no-op)
2022-07-26 11:16:51 +02:00
Raymond Hettinger 4395ff1e6a
Statistics inv_cdf sync with corresponding random module normal distributions (#95265) 2022-07-26 02:23:33 -05:00
Serhiy Storchaka 68c555a50a
gh-95041: Fix several minor issues in syslog.openlog() (GH-95058)
* syslog_get_argv() swallows exceptions, but not in all cases.
* if ident is non UTF-8 encodable, syslog.openlog() fails after setting the
  global reference to ident. Now the C string saved internally in the previous
  call to openlog() points to the freed memory.
* PySys_Audit() can crash if ident is NULL.
* There may be a race condition with syslog.syslog(), because the global
  reference to ident is decrefed before setting the new value.
* Possible use of freed memory if syslog.openlog() is called while
  the GIL is released in syslog.syslog().
2022-07-26 09:12:10 +03:00
Mark Shannon 27055d766a
GH-92678: Expose managed dict clear and visit functions (#95246) 2022-07-25 22:30:53 +01:00
Christian Heimes d291a82df3
gh-90473: Check for HAVE_KILL in main.c:exit_sigint (GH-95165) 2022-07-23 12:29:00 +02:00