summaryrefslogtreecommitdiffstats
path: root/Modules
Commit message (Collapse)AuthorAgeFilesLines
* Fix division by 0 when checking for overflow in math.prod (GH-11808)Pablo Galindo2019-02-101-2/+2
|
* lru_cache: Add more comments. Fix comment typos. Clarify a comment. (GH-11795)Raymond Hettinger2019-02-091-4/+25
|
* bpo-35606: Implement math.prod (GH-11359)Pablo Galindo2019-02-072-1/+205
|
* bpo-32417: Make timedelta arithmetic respect subclasses (#10902)Paul Ganssle2019-02-041-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | * Make timedelta return subclass types Previously timedelta would always return the `date` and `datetime` types, regardless of what it is added to. This makes it return an object of the type it was added to. * Add tests for timedelta arithmetic on subclasses * Make pure python timedelta return subclass types * Add test for fromtimestamp with tz argument * Add tests for subclass behavior in now * Add news entry. Fixes: bpo-32417 bpo-35364 * More descriptive variable names in tests Addresses Victor's comments
* bpo-29734: nt._getfinalpathname handle leak (GH-740)Mark Becwar2019-02-021-8/+10
| | | Make sure that failure paths call CloseHandle outside of the function that failed
* bpo-33895: Relase GIL while calling functions that acquire Windows loader ↵Tony Roberts2019-02-024-6/+31
| | | | | lock (GH-7789) LoadLibrary, GetProcAddress, FreeLibrary and GetModuleHandle acquire the system loader lock. Calling these while holding the GIL will cause a deadlock on the rare occasion that another thread is detaching and needs to destroy its thread state at the same time.
* bpo-35813: Added shared_memory submodule of multiprocessing. (#11664)Davin Potts2019-02-021-0/+724
| | | Added shared_memory submodule to multiprocessing in time for first alpha with cross-platform tests soon to follow.
* bpo-35537: Fix function name in os.posix_spawnp() errors (GH-11719)Victor Stinner2019-02-011-11/+13
|
* bpo-35537: Add setsid parameter to os.posix_spawn() and os.posix_spawnp() ↵Joannah Nanjekye2019-02-012-31/+57
| | | | (GH-11608)
* Speed-up argument parsing for common cases in deque.__init__()(GH-11717)Raymond Hettinger2019-02-011-3/+7
|
* Consistently move the misses update to just before the user function call ↵Raymond Hettinger2019-01-311-3/+5
| | | | (GH-11715)
* bpo-35766: Merge typed_ast back into CPython (GH-11645)Guido van Rossum2019-01-311-0/+6
|
* Move float conversion into a macro. Apply to fsum (GH-11698)Raymond Hettinger2019-01-301-49/+32
|
* bpo-35847: RISC-V needs CTYPES_PASS_BY_REF_HACK (GH-11694)Andreas Schwab2019-01-291-1/+1
| | | | | | This fixes the ctypes.test.test_structures.StructureTestCase test. https://bugs.python.org/issue35847
* Fast path for int inputs to math.dist() and math.hypot() (GH-11692)Raymond Hettinger2019-01-281-3/+24
|
* bpo-35780: Fix errors in lru_cache() C code (GH-11623)Raymond Hettinger2019-01-261-84/+188
|
* bpo-35720: Fixing a memory leak in pymain_parse_cmdline_impl() (GH-11528)Lucas Cimon2019-01-221-0/+1
| | | | | | When the loop in the pymain_read_conf function in this same file calls pymain_init_cmdline_argv() a 2nd time, the pymain->command buffer of wchar_t is overriden and the previously allocated memory is never freed.
* bpo-33416: Add end positions to Python AST (GH-11605)Ivan Levkivskyi2019-01-221-1/+1
| | | | | | | | | | | | | | | | | | The majority of this PR is tediously passing `end_lineno` and `end_col_offset` everywhere. Here are non-trivial points: * It is not possible to reconstruct end positions in AST "on the fly", some information is lost after an AST node is constructed, so we need two more attributes for every AST node `end_lineno` and `end_col_offset`. * I add end position information to both CST and AST. Although it may be technically possible to avoid adding end positions to CST, the code becomes more cumbersome and less efficient. * Since the end position is not known for non-leaf CST nodes while the next token is added, this requires a bit of extra care (see `_PyNode_FinalizeEndPos`). Unless I made some mistake, the algorithm should be linear. * For statements, I "trim" the end position of suites to not include the terminal newlines and dedent (this seems to be what people would expect), for example in ```python class C: pass pass ``` the end line and end column for the class definition is (2, 8). * For `end_col_offset` I use the common Python convention for indexing, for example for `pass` the `end_col_offset` is 4 (not 3), so that `[0:4]` gives one the source code that corresponds to the node. * I added a helper function `ast.get_source_segment()`, to get source text segment corresponding to a given AST node. It is also useful for testing. An (inevitable) downside of this PR is that AST now takes almost 25% more memory. I think however it is probably justified by the benefits.
* bpo-35674: Add os.posix_spawnp() (GH-11554)Joannah Nanjekye2019-01-162-35/+175
| | | Add a new os.posix_spawnp() function.
* bpo-35746: Fix segfault in ssl's cert parser (GH-11569)Christian Heimes2019-01-151-0/+4
| | | | | | | | | | | Fix a NULL pointer deref in ssl module. The cert parser did not handle CRL distribution points with empty DP or URI correctly. A malicious or buggy certificate can result into segfault. Signed-off-by: Christian Heimes <christian@python.org> https://bugs.python.org/issue35746
* bpo-35066: _dateime.datetime.strftime copies trailing '%' (GH-10692)MichaelSaah2019-01-141-5/+8
| | | | | | | Previously, calling the strftime() method on a datetime object with a trailing '%' in the format string would result in an exception. However, this only occured when the datetime C module was being used; the python implementation did not match this behavior. Datetime is now PEP-399 compliant, and will not throw an exception on a trailing '%'.
* bpo-35719: Optimize multi-argument math functions. (GH-11527)Serhiy Storchaka2019-01-121-19/+18
| | | | | Use the fast call convention for math functions atan2(), copysign(), hypot() and remainder() and inline unpacking arguments. This sped up them by 1.3--2.5 times.
* bpo-35582: Inline arguments tuple unpacking in handwritten code. (GH-11524)Serhiy Storchaka2019-01-121-11/+10
| | | | | Inline PyArg_UnpackTuple() and _PyArg_UnpackStack() in performance sensitive code in the builtins and operator modules.
* bpo-34838: Use subclass_of for math.dist. (GH-9659)Ammar Askar2019-01-122-9/+12
| | | | | Argument clinic now generates fast inline code for positional parsing, so the manually implemented type check in math.dist can be removed.
* bpo-35423: Stop using the "pending calls" machinery for signals. (gh-10972)Eric Snow2019-01-111-0/+6
| | | | | This change separates the signal handling trigger in the eval loop from the "pending calls" machinery. There is no semantic change and the difference in performance is insignificant. The change makes both components less confusing. It also eliminates the risk of changes to the pending calls affecting signal handling. This is particularly relevant for some upcoming pending calls changes I have in the works.
* bpo-35582: Argument Clinic: Optimize the "all boring objects" case. (GH-11520)Serhiy Storchaka2019-01-1116-256/+355
| | | | | Use _PyArg_CheckPositional() and inlined code instead of PyArg_UnpackTuple() and _PyArg_UnpackStack() if all parameters are positional and use the "object" converter.
* bpo-35582: Argument Clinic: inline parsing code for positional parameters. ↵Serhiy Storchaka2019-01-1141-522/+4621
| | | | (GH-11313)
* bpo-32710: Fix _overlapped.Overlapped memory leaks (GH-11489)Victor Stinner2019-01-111-24/+54
| | | | | | | | | | | | Fix memory leaks in asyncio ProactorEventLoop on overlapped operation failures. Changes: * Implement the tp_traverse slot in the _overlapped.Overlapped type to help to break reference cycles and identify referrers in the garbage collector. * Always clear overlapped on failure: not only set type to TYPE_NOT_STARTED, but release also resources.
* bpo-35702: Add new identifier time.CLOCK_UPTIME_RAW for macOS 10.12 (GH-11503)Joannah Nanjekye2019-01-101-0/+3
|
* bpo-32710: Fix leak in Overlapped_WSASend() (GH-11469)Victor Stinner2019-01-081-0/+2
| | | | | Fix a memory leak in asyncio in the ProactorEventLoop when ReadFile() or WSASend() overlapped operation fail immediately: release the internal buffer.
* bpo-35568: add 'raise_signal' function (GH-11335)Vladimir Matveev2019-01-083-22/+60
| | | | | | As in title, expose C `raise` function as `raise_function` in `signal` module. Also drop existing `raise_signal` in `_testcapi` module and replace all usages with new function. https://bugs.python.org/issue35568
* bpo-35664: Optimize operator.itemgetter (GH-11435)Raymond Hettinger2019-01-071-5/+37
|
* closes bpo-35643: Fix a SyntaxWarning: invalid escape sequence in ↵Mickaël Schoentgen2019-01-021-1/+1
| | | | Modules/_sha3/cleanup.py (GH-11411)
* bpo-32492: Tweak _collections._tuplegetter. (GH-11367)Serhiy Storchaka2018-12-311-8/+8
| | | | | | * Replace the docstrings cache with sys.intern(). * Improve tests. * Unify names of tp_descr_get and tp_descr_set functions.
* bpo-35214: Annotate posix calls for clang MSan. (#11389)Gregory P. Smith2018-12-311-0/+16
| | | It doesn't know the details of a few less common libc functions.
* bpo-35550: Fix incorrect Solaris define guards (GH-11275)Jakub Kulík2018-12-314-5/+5
| | | | | | | Python source code uses on several places ifdef sun or defined(sun) without the underscores, which is not standard compliant and shouldn't be used. Defines should check for __sun instead. Reference: http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_system#Solaris https://bugs.python.org/issue35550
* Dead code removal from _hashopenssl. (GH-11379)Gregory P. Smith2018-12-312-121/+19
| | | | HASH_OBJ_CONSTRUCTOR has always been defined as 0 since I created hashlib in Python 2.5. Delete all code associated with it.
* bpo-35214: MSan workarounds for socket, time, and test_faulthandler. (GH-11375)Gregory P. Smith2018-12-312-0/+27
| | | | | Add Clang Memory Sanitizer build instrumentation to work around false positives from the socket and time modules as well as skipping a couple test_faulthandler tests.
* bpo-28503: Use crypt_r() when available instead of crypt() (GH-11373)Gregory P. Smith2018-12-301-1/+9
| | | | | Use crypt_r() when available instead of crypt() in the crypt module. As a nice side effect: This also avoids a memory sanitizer flake as clang msan doesn't know about crypt's internal libc allocated buffer.
* bpo-32492: 1.6x speed up in namedtuple attribute access using C fast-path ↵Pablo Galindo2018-12-302-0/+191
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#10495) * bpo-32492: 2.5x speed up in namedtuple attribute access using C fast path * Add News entry * fixup! bpo-32492: 2.5x speed up in namedtuple attribute access using C fast path * Check for tuple in the __get__ of the new descriptor and don't cache the descriptor itself * Don't inherit from property. Implement GC methods to handle __doc__ * Add a test for the docstring substitution in descriptors * Update NEWS entry to reflect time against 3.7 branch * Simplify implementation with argument clinic, better error messages, only __new__ * Use positional-only parameters for the __new__ * Use PyTuple_GET_SIZE and PyTuple_GET_ITEM to tighter the implementation of tuplegetterdescr_get * Implement __set__ to make tuplegetter a data descriptor * Use Py_INCREF now that we inline PyTuple_GetItem * Apply the valid_index() function, saving one test * Move Py_None test out of the critical path.
* bpo-34373: fix test_mktime and test_pthread_getcpuclickid tests on AIX (GH-8726)Michael Felt2018-12-281-12/+33
| | | | | | | | | * Fix test_mktime on AIX by adding code to get mktime to behave the same way as it does on other *nix systems * Fix test_pthread_getcpuclickid in AIX by adjusting the test case expectations when running on AIX in 32-bit mode Patch by Michael Felt.
* bpo-20182: AC convert remaining functions/methods in _hashopenssl.c (GH-9213)Tal Einat2018-12-272-100/+303
|
* bpo-27643 - skip test_ctypes test case with XLC compiler. (GH-5164)Michael Felt2018-12-261-4/+14
| | | | | | | | | This test case needs "signed short" bitfields, but the IBM XLC compiler (on AIX) does not support this. Skip the code and test when AIX and XLC are used. Use __xlc__ as identifier to detect the XLC compiler.
* bpo-23867: Argument Clinic: inline parsing code for a single positional ↵Serhiy Storchaka2018-12-2533-206/+1004
| | | | parameter. (GH-9689)
* bpo-35529: Fix a reference counting bug in PyCFuncPtr_FromDll(). (GH-11229)Zackery Spytz2018-12-201-5/+8
| | | | | "dll" would leak if an error occurred in _validate_paramflags() or GenericPyCData_new().
* bpo-35502: Fix reference leaks in ElementTree.TreeBuilder. (GH-11170)Serhiy Storchaka2018-12-181-0/+5
|
* bpo-35504: Fix segfaults and SystemErrors when deleting certain attrs. ↵Zackery Spytz2018-12-176-0/+32
| | | | (GH-11175)
* bpo-35490: Remove the DecodeFSDefault return converter in AC. (#11152)Serhiy Storchaka2018-12-172-14/+10
|
* bpo-35415: validate fileno argument to socket.socket (GH-10917)Dima Tisnek2018-12-171-20/+29
| | | https://bugs.python.org/issue35415
* bpo-35489: Use "const Py_UNICODE *" for the Py_UNICODE converter in AC. ↵Serhiy Storchaka2018-12-146-22/+26
| | | | (GH-11150)