summaryrefslogtreecommitdiffstats
path: root/Include/pyport.h
Commit message (Collapse)AuthorAgeFilesLines
* bpo-41617: Add _Py__has_builtin() macro (GH-23260)Victor Stinner2020-11-131-0/+12
| | | | | | | | | | | Fix building pycore_bitutils.h internal header on old clang version without __builtin_bswap16() (ex: Xcode 4.6.3 on Mac OS X 10.7). Add a new private _Py__has_builtin() macro to check for availability of a preprocessor builtin function. Co-Authored-By: Joshua Root <jmr@macports.org> Co-authored-by: Joshua Root <jmr@macports.org>
* bpo-42236: Use UTF-8 encoding if nl_langinfo(CODESET) fails (GH-23086)Victor Stinner2020-11-011-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the nl_langinfo(CODESET) function returns an empty string, Python now uses UTF-8 as the filesystem encoding. In May 2010 (commit b744ba1d14c5487576c95d0311e357b707600b47), I modified Python to log a warning and use UTF-8 as the filesystem encoding (instead of None) if nl_langinfo(CODESET) returns an empty string. In August 2020 (commit 94908bbc1503df830d1d615e7b57744ae1b41079), I modified Python startup to fail with a fatal error and a specific error message if nl_langinfo(CODESET) returns an empty string. The intent was to prevent guessing the encoding and also investigate user configuration where this case happens. In 10 years (2010 to 2020), I saw zero user report about the error message related to nl_langinfo(CODESET) returning an empty string. Today, UTF-8 became the defacto standard and it's safe to make the assumption that the user expects UTF-8. For example, nl_langinfo(CODESET) can return an empty string on macOS if the LC_CTYPE locale is not supported, and UTF-8 is the default encoding on macOS. While this change is likely to not affect anyone in practice, it should make UTF-8 lover happy ;-) Rewrite also the documentation explaining how Python selects the filesystem encoding and error handler.
* bpo-19569: Add a macro to suppress deprecation warnings (GH-9004)Zackery Spytz2020-06-161-0/+20
| | | Co-authored-by: Arfrever Frehtes Taifersar Arahesis <arfrever.fta@gmail.com>
* bpo-40943: Replace PY_FORMAT_SIZE_T with "z" (GH-20781)Victor Stinner2020-06-101-1/+3
| | | | | | | The PEP 353, written in 2005, introduced PY_FORMAT_SIZE_T. Python no longer supports macOS 10.4 and Visual Studio 2010, but requires more recent macOS and Visual Studio versions. In 2020 with Python 3.10, it is now safe to use directly "%zu" to format size_t and "%zi" to format Py_ssize_t.
* bpo-40244: Remove XLC's support from the noreturn flag (GH-20588)Batuhan Taskaya2020-06-021-2/+2
| | | Automerge-Triggered-By: @pablogsal
* bpo-40302: Add pycore_byteswap.h header file (GH-19552)Victor Stinner2020-04-171-4/+4
| | | | | | | | | | | | | | Add a new internal pycore_byteswap.h header file with the following functions: * _Py_bswap16() * _Py_bswap32() * _Py_bswap64() Use these functions in _ctypes, sha256 and sha512 modules, and also use in the UTF-32 encoder. sha256, sha512 and _ctypes modules are now built with the internal C API.
* bpo-40096: Support __attribute__((__noreturn__)) on xlc (GH-19204)Batuhan Taşkaya2020-03-291-0/+1
|
* bpo-11410: Standardize and use symbol visibility attributes across POSIX and ↵Vinay Sajip2019-10-151-11/+13
| | | | Windows. (GH-16347)
* closes bpo-38253: Fix typo of Py_SET_ERANGE_IF_OVERFLOW in pyport.h. (GH-16230)Hai Shi2019-09-241-1/+1
|
* bpo-37781: use "z" for PY_FORMAT_SIZE_T (GH-15156)Inada Naoki2019-08-301-13/+6
| | | MSVC 2015 supports %zd / %zu. "z" is portable enough nowadays.
* bpo-33407: Implement Py_DEPRECATED() on MSVC (GH-8980)Zackery Spytz2019-05-281-3/+7
|
* bpo-36475: Make PyThread_exit_thread with _Py_NO_RETURN (GH-13068)Victor Stinner2019-05-041-0/+14
|
* bpo-36775: Add _Py_FORCE_UTF8_FS_ENCODING macro (GH-13056)Victor Stinner2019-05-021-0/+10
| | | | | | | Add _Py_FORCE_UTF8_LOCALE and _Py_FORCE_UTF8_FS_ENCODING macros to avoid factorize "#if defined(__ANDROID__) || defined(__VXWORKS__)" and "#if defined(__APPLE__)". Cleanup also config_init_fs_encoding().
* bpo-36722: Don't define ALT_SOABI for Py_TRACE_REFS build (GH-12973)Victor Stinner2019-04-261-4/+10
| | | | Py_TRACE_REFS ABI is incompatible with release and debug (Py_DEBUG) ABI.
* bpo-36071 Add support for Windows ARM32 in ctypes/libffi (GH-12059)Paul Monson2019-04-181-1/+1
|
* bpo-36635: Change pyport.h for Py_BUILD_CORE_MODULE define (GH-12853)Victor Stinner2019-04-171-2/+23
| | | | | | | | | | | | | | | | | | | | Change PyAPI_FUNC(type), PyAPI_DATA(type) and PyMODINIT_FUNC macros of pyport.h when Py_BUILD_CORE_MODULE is defined. The Py_BUILD_CORE_MODULE define must be now be used to build a C extension as a dynamic library accessing Python internals: export the PyInit_xxx() function in DLL exports on Windows. Changes: * Py_BUILD_CORE_BUILTIN and Py_BUILD_CORE_MODULE now imply Py_BUILD_CORE directy in pyport.h. * ceval.c compilation now fails with an error if Py_BUILD_CORE is not defined, just to ensure that Python is build with the correct defines. * setup.py now compiles _pickle.c with Py_BUILD_CORE_MODULE define. * setup.py compiles _json.c with Py_BUILD_CORE_MODULE define, rather than Py_BUILD_CORE_BUILTIN define * PCbuild/pythoncore.vcxproj: Add Py_BUILD_CORE_BUILTIN define.
* bpo-35758: Fix building on ARM + MSVC (gh-11531)Minmin Gong2019-01-211-1/+1
| | | | | | | | | | * Disable x87 control word for non-x86 targets On msvc, x87 control word is only available on x86 target. Need to disable it for other targets to prevent compiling problems. * Include immintrin.h on x86 and x64 only Immintrin.h is only available on x86 and x64. Need to disable it for other targets to prevent compiling problems.
* bpo-35059: Remove Py_STATIC_INLINE() macro (GH-10216)Victor Stinner2018-10-291-17/+0
| | | | "static inline" should be used directly. Forcing the compiler to inline is not recommended.
* bpo-35059: Add Py_STATIC_INLINE() macro (GH-10093)Victor Stinner2018-10-251-11/+28
| | | | | | | | | * Add Py_STATIC_INLINE() macro to declare a "static inline" function. If the compiler supports it, try to always inline the function even if no optimization level was specified. * Modify pydtrace.h to use Py_STATIC_INLINE() when WITH_DTRACE is not defined. * Add an unit test on Py_DECREF() to make sure that _Py_NegativeRefcount() reports the correct filename.
* bpo-33720: Refactor marshalling/unmarshalling floats. (GH-8071)Serhiy Storchaka2018-07-241-2/+4
|
* bpo-32593: Drop FreeBSD 9 and older support (#5232)Victor Stinner2018-01-221-11/+1
| | | Drop support of FreeBSD 9 and older.
* bpo-29040: Support building Android with Unified Headers (GH-4492)xdegaye2017-11-231-1/+3
|
* bpo-30768: Recompute timeout on interrupted lock (GH-4103)Victor Stinner2017-10-241-0/+3
| | | | | | | | | | | | | | | | Fix the pthread+semaphore implementation of PyThread_acquire_lock_timed() when called with timeout > 0 and intr_flag=0: recompute the timeout if sem_timedwait() is interrupted by a signal (EINTR). See also the PEP 475. The pthread implementation of PyThread_acquire_lock() now fails with a fatal error if the timeout is larger than PY_TIMEOUT_MAX, as done in the Windows implementation. The check prevents any risk of overflow in PyThread_acquire_lock(). Add also PY_DWORD_MAX constant.
* remove support for BSD/OS (closes bpo-31624) (#3812)Benjamin Peterson2017-09-291-10/+0
|
* bpo-30860: Move windows.h include out of internal/*.h. (#3458)Eric Snow2017-09-121-2/+2
| | | PR #3397 introduced a large number of warnings to the Windows build. This patch fixes them.
* bpo-31370: Remove support for threads-less builds (#3385)Antoine Pitrou2017-09-071-0/+8
| | | | | | * Remove Setup.config * Always define WITH_THREAD for compatibility.
* remove configure test for inline keyword (#1231)Benjamin Peterson2017-04-211-4/+1
| | | We require C99, so a configure test for this standard feature is not needed.
* Fix the only non-C90 comment to be C90 compatible. (#566)n.d. parker2017-03-081-1/+1
|
* Fixed a typo in the comment in Include/pyport.h (#425)Joseph Shen2017-03-031-1/+1
| | | #ifdef HAVE_DECLSPEC_DLL / #endif mismatch
* Disable _PyStack_AsTuple() inliningVictor Stinner2017-01-111-1/+14
| | | | | | | | | | | | | | | Issue #29234: Inlining _PyStack_AsTuple() into callers increases their stack consumption, Disable inlining to optimize the stack consumption. Add _Py_NO_INLINE: use __attribute__((noinline)) of GCC and Clang. It reduces the stack consumption, bytes per call, before => after: test_python_call: 1040 => 976 (-64 B) test_python_getitem: 976 => 912 (-64 B) test_python_iterator: 1120 => 1056 (-64 B) => total: 3136 => 2944 (- 192 B)
* Merge 3.6Victor Stinner2017-01-051-1/+1
|\
| * Issue #27961: Define HAVE_LONG_LONG as 1.Victor Stinner2017-01-051-1/+1
| | | | | | | | | | Fix backward compatibility issue, HAVE_LONG_LONG was defined but empty, whereas it is defined as 1 in Python 3.5.
* | merge 3.6 (#28898)Benjamin Peterson2016-12-081-2/+3
|\ \ | |/
| * guard HAVE_LONG_LONG definition to prevent redefinition (#28898)Benjamin Peterson2016-12-081-2/+3
| |
* | Issue #28618: Mark dict lookup functions as hotVictor Stinner2016-11-151-2/+2
| | | | | | | | It's common to see these functions in the top 3 of "perf report".
* | Issue #28618: Make hot functions using __attribute__((hot))Victor Stinner2016-11-111-2/+25
|/ | | | | | | | | | | | | | | | | | | | When Python is not compiled with PGO, the performance of Python on call_simple and call_method microbenchmarks depend highly on the code placement. In the worst case, the performance slowdown can be up to 70%. The GCC __attribute__((hot)) attribute helps to keep hot code close to reduce the risk of such major slowdown. This attribute is ignored when Python is compiled with PGO. The following functions are considered as hot according to statistics collected by perf record/perf report: * _PyEval_EvalFrameDefault() * call_function() * _PyFunction_FastCall() * PyFrame_New() * frame_dealloc() * PyErr_Occurred()
* replace usage of Py_VA_COPY with the (C99) standard va_copyBenjamin Peterson2016-09-211-9/+1
|
* merge 3.5 (#28184)Benjamin Peterson2016-09-201-1/+1
|\
| * remove trailing whitespaceBenjamin Peterson2016-09-201-1/+1
| |
* | stop using Py_LL and Py_ULLBenjamin Peterson2016-09-191-4/+0
| |
* | always define HAVE_LONG_LONG (#27961)Benjamin Peterson2016-09-191-0/+3
| |
* | Issue #28126: Replace Py_MEMCPY with memcpy(). Visual Studio can properly ↵Christian Heimes2016-09-131-31/+14
| | | | | | | | optimize memcpy().
* | more PY_LONG_LONG to long longBenjamin Peterson2016-09-081-30/+0
| |
* | replace PY_SIZE_MAX with SIZE_MAXBenjamin Peterson2016-09-071-9/+1
| |
* | require uintptr_t to existBenjamin Peterson2016-09-061-21/+0
| |
* | only include inttypes.h (#17884)Benjamin Peterson2016-09-061-3/+0
| |
* | require standard int types to be defined (#17884)Benjamin Peterson2016-09-061-51/+1
| |
* | replace PY_LONG_LONG with long longBenjamin Peterson2016-09-061-2/+2
| |
* | require a long long data type (closes #27961)Benjamin Peterson2016-09-061-17/+8
| |
* | Issue #10910: merge from 3.5Ned Deily2016-08-151-1/+10
|\ \ | |/