Commit Graph

279 Commits

Author SHA1 Message Date
Ryan Burns
925bbece2f cpython: remove upstreamed patch
This patch has been merged in python 3.9.7.

4b55837e7c
2021-12-03 13:18:38 -08:00
Martin Weinelt
59cd736ec2 python39: backport patch to accomodate system library changes in Big Sur
(cherry picked from commit 9738723b2486cfe9988abbff0c873cce5cba1849)
2021-12-02 18:00:12 -08:00
Jörg Thalheim
96956d7682
Merge pull request #145265 from Stunkymonkey/development-pname-version-3
pkgs/development: rename name to pname&version part 3
2021-12-02 14:56:34 +00:00
Felix Buehler
7678aa30b4 pkgs/development: rename name to pname&version 2021-11-30 21:32:28 +01:00
Martin Weinelt
6dd0b1b8fc python311: init at 3.11.0a2 2021-11-30 14:19:52 +01:00
sterni
5d0972c63b
Merge pull request #138289 from sternenseemann/fix-non-gnu-strip
stdenv: move --enable-deterministic-archives flag into GNU wrapper
2021-10-07 12:29:59 +02:00
r-burns
16728283c3
Merge pull request #135619 from r-burns/fpie-musl-fixes
[staging] {cc,binutils}-wrapper: fixes for PIE hardening
2021-09-23 17:55:08 -07:00
Ryan Burns
a41b83c0ff Revert "pkgsMusl.python*: disable LTO"
This is no longer needed with the previous PIE hardening fixes.

This reverts commit 2784f1bd69.
2021-09-20 17:24:12 -07:00
sternenseemann
1174f3030c python3: fix NIX_LDFLAGS logic
* Only try to link libgcc if GCC is actually used

* Link libgcc depending on libc (glibc vs. musl), rather than
  Linux/musl vs. Linux/!musl

This is a step towards fixing pkgsLLVM.python3.
2021-09-18 15:11:17 +02:00
Robert Scott
ddbc53075b
Merge pull request #110893 from risicle/ris-cpython-debug-v2
cpython: add separateDebugInfo v2
2021-09-13 20:20:28 +01:00
Martin Weinelt
5c3a01ad51
cpython: fix duplicate function arguments
Merging gone bad, sorry.
2021-08-30 16:14:01 +02:00
Martin Weinelt
e2575c7de1
Merge branch 'master' into staging-next 2021-08-30 16:08:03 +02:00
sternenseemann
2784f1bd69 pkgsMusl.python*: disable LTO
LTO fails to build with musl with the following linker error:

```
rm -f libpython3.9.a
if test libpython3.9.so.1.0 != libpython3.9.so; then \
        gcc -shared -L/nix/store/1dlhc7w4dlacgmkjbcx9454givv4kdqj-zlib-1.2.11/lib -L/nix/store/6fdwln0ac2p100dhifk2picm0c2d0bw3-bzip2-1.0.6.0.2/lib -L/nix/store/540aidi6ppgnjdd60ky4m6sm6ml824sp-expat-2.4.1/lib -L/nix/store/b493yxrr0glvv3988mkagqlq5k8rg5g1-xz-5.2.5/lib -L/nix/store/2145y7j63691khrjqhn66gc3srb52af8-libffi-3.3/lib -L/nix/store/4h0qimk9kkkrd1v9j6j0v3r3gqg6w22a-gdbm-1.20/lib -L/nix/store/b8n0k1vhjdg0r95x8d2ybgrmbdlhw738-sqlite-3.35.5/lib -L/nix/store/f4y7v8k7ar3n05h3446k6z4aa1c77n22-readline-6.3p08/lib -L/nix/store/j79lxjyfin611lz3rm0mzc26afxm3dgm-ncurses-6.2/lib -L/nix/store/mqs20xckz2gj0asgy2hv60h5dg1i3ci5-openssl-1.1.1k/lib -L/nix/store/hbfls4hgbjn8cb0d4m0kgz4a4cwlcbx5-tzdata-2021a/lib -L/nix/store/1dlhc7w4dlacgmkjbcx9454givv4kdqj-zlib-1.2.11/lib -L/nix/store/6fdwln0ac2p100dhifk2picm0c2d0bw3-bzip2-1.0.6.0.2/lib -L/nix/store/540aidi6ppgnjdd60ky4m6sm6ml824sp-expat-2.4.1/lib -L/nix/store/b493yxrr0glvv3988mkagqlq5k8rg5g1-xz-5.2.5/lib -L/nix/store/2145y7j63691khrjqhn66gc3srb52af8-libffi-3.3/lib -L/nix/store/4h0qimk9kkkrd1v9j6j0v3r3gqg6w22a-gdbm-1.20/lib -L/nix/store/b8n0k1vhjdg0r95x8d2ybgrmbdlhw738-sqlite-3.35.5/lib -L/nix/store/f4y7v8k7ar3n05h3446k6z4aa1c77n22-readline-6.3p08/lib -L/nix/store/j79lxjyfin611lz3rm0mzc26afxm3dgm-ncurses-6.2/lib -L/nix/store/mqs20xckz2gj0asgy2hv60h5dg1i3ci5-openssl-1.1.1k/lib -L/nix/store/hbfls4hgbjn8cb0d4m0kgz4a4cwlcbx5-tzdata-2021a/lib -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g  -Wl,-hlibpython3.9.so.1.0 -o libpython3.9.so.1.0 Modules/getbuildinfo.o Parser/acceler.o Parser/grammar1.o Parser/listnode.o Parser/node.o Parser/parser.o Parser/token.o  Parser/pegen/pegen.o Parser/pegen/parse.o Parser/pegen/parse_string.o Parser/pegen/peg_api.o Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.o Objects/abstract.o Objects/accu.o Objects/boolobject.o Objects/bytes_methods.o Objects/bytearrayobject.o Objects/bytesobject.o Objects/call.o Objects/capsule.o Objects/cellobject.o Objects/classobject.o Objects/codeobject.o Objects/complexobject.o Objects/descrobject.o Objects/enumobject.o Objects/exceptions.o Objects/genericaliasobject.o Objects/genobject.o Objects/fileobject.o Objects/floatobject.o Objects/frameobject.o Objects/funcobject.o Objects/interpreteridobject.o Objects/iterobject.o Objects/listobject.o Objects/longobject.o Objects/dictobject.o Objects/odictobject.o Objects/memoryobject.o Objects/methodobject.o Objects/moduleobject.o Objects/namespaceobject.o Objects/object.o Objects/obmalloc.o Objects/picklebufobject.o Objects/rangeobject.o Objects/setobject.o Objects/sliceobject.o Objects/structseq.o Objects/tupleobject.o Objects/typeobject.o Objects/unicodeobject.o Objects/unicodectype.o Objects/weakrefobject.o Python/_warnings.o Python/Python-ast.o Python/asdl.o Python/ast.o Python/ast_opt.o Python/ast_unparse.o Python/bltinmodule.o Python/ceval.o Python/codecs.o Python/compile.o Python/context.o Python/dynamic_annotations.o Python/errors.o Python/frozenmain.o Python/future.o Python/getargs.o Python/getcompiler.o Python/getcopyright.o Python/getplatform.o Python/getversion.o Python/graminit.o Python/hamt.o Python/hashtable.o Python/import.o Python/importdl.o Python/initconfig.o Python/marshal.o Python/modsupport.o Python/mysnprintf.o Python/mystrtoul.o Python/pathconfig.o Python/peephole.o Python/preconfig.o Python/pyarena.o Python/pyctype.o Python/pyfpe.o Python/pyhash.o Python/pylifecycle.o Python/pymath.o Python/pystate.o Python/pythonrun.o Python/pytime.o Python/bootstrap_hash.o Python/structmember.o Python/symtable.o Python/sysmodule.o Python/thread.o Python/traceback.o Python/getopt.o Python/pystrcmp.o Python/pystrtod.o Python/pystrhex.o Python/dtoa.o Python/formatter_unicode.o Python/fileutils.o Python/dynload_shlib.o    Modules/config.o Modules/getpath.o Modules/main.o Modules/gcmodule.o Modules/posixmodule.o  Modules/errnomodule.o  Modules/pwdmodule.o  Modules/_sre.o  Modules/_codecsmodule.o  Modules/_weakref.o  Modules/_functoolsmodule.o  Modules/_operator.o  Modules/_collectionsmodule.o  Modules/_abc.o  Modules/itertoolsmodule.o  Modules/atexitmodule.o  Modules/signalmodule.o  Modules/_stat.o  Modules/timemodule.o  Modules/_threadmodule.o  Modules/_localemodule.o  Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o  Modules/faulthandler.o  Modules/_tracemalloc.o  Modules/_peg_parser.o  Modules/symtablemodule.o  Modules/xxsubtype.o Python/frozen.o   -ldl -lcrypt -lncurses -lm  -lm; \
        ln -f libpython3.9.so.1.0 libpython3.9.so; \
else \
        gcc -shared -L/nix/store/1dlhc7w4dlacgmkjbcx9454givv4kdqj-zlib-1.2.11/lib -L/nix/store/6fdwln0ac2p100dhifk2picm0c2d0bw3-bzip2-1.0.6.0.2/lib -L/nix/store/540aidi6ppgnjdd60ky4m6sm6ml824sp-expat-2.4.1/lib -L/nix/store/b493yxrr0glvv3988mkagqlq5k8rg5g1-xz-5.2.5/lib -L/nix/store/2145y7j63691khrjqhn66gc3srb52af8-libffi-3.3/lib -L/nix/store/4h0qimk9kkkrd1v9j6j0v3r3gqg6w22a-gdbm-1.20/lib -L/nix/store/b8n0k1vhjdg0r95x8d2ybgrmbdlhw738-sqlite-3.35.5/lib -L/nix/store/f4y7v8k7ar3n05h3446k6z4aa1c77n22-readline-6.3p08/lib -L/nix/store/j79lxjyfin611lz3rm0mzc26afxm3dgm-ncurses-6.2/lib -L/nix/store/mqs20xckz2gj0asgy2hv60h5dg1i3ci5-openssl-1.1.1k/lib -L/nix/store/hbfls4hgbjn8cb0d4m0kgz4a4cwlcbx5-tzdata-2021a/lib -L/nix/store/1dlhc7w4dlacgmkjbcx9454givv4kdqj-zlib-1.2.11/lib -L/nix/store/6fdwln0ac2p100dhifk2picm0c2d0bw3-bzip2-1.0.6.0.2/lib -L/nix/store/540aidi6ppgnjdd60ky4m6sm6ml824sp-expat-2.4.1/lib -L/nix/store/b493yxrr0glvv3988mkagqlq5k8rg5g1-xz-5.2.5/lib -L/nix/store/2145y7j63691khrjqhn66gc3srb52af8-libffi-3.3/lib -L/nix/store/4h0qimk9kkkrd1v9j6j0v3r3gqg6w22a-gdbm-1.20/lib -L/nix/store/b8n0k1vhjdg0r95x8d2ybgrmbdlhw738-sqlite-3.35.5/lib -L/nix/store/f4y7v8k7ar3n05h3446k6z4aa1c77n22-readline-6.3p08/lib -L/nix/store/j79lxjyfin611lz3rm0mzc26afxm3dgm-ncurses-6.2/lib -L/nix/store/mqs20xckz2gj0asgy2hv60h5dg1i3ci5-openssl-1.1.1k/lib -L/nix/store/hbfls4hgbjn8cb0d4m0kgz4a4cwlcbx5-tzdata-2021a/lib -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g  -o libpython3.9.so Modules/getbuildinfo.o Parser/acceler.o Parser/grammar1.o Parser/listnode.o Parser/node.o Parser/parser.o Parser/token.o  Parser/pegen/pegen.o Parser/pegen/parse.o Parser/pegen/parse_string.o Parser/pegen/peg_api.o Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.o Objects/abstract.o Objects/accu.o Objects/boolobject.o Objects/bytes_methods.o Objects/bytearrayobject.o Objects/bytesobject.o Objects/call.o Objects/capsule.o Objects/cellobject.o Objects/classobject.o Objects/codeobject.o Objects/complexobject.o Objects/descrobject.o Objects/enumobject.o Objects/exceptions.o Objects/genericaliasobject.o Objects/genobject.o Objects/fileobject.o Objects/floatobject.o Objects/frameobject.o Objects/funcobject.o Objects/interpreteridobject.o Objects/iterobject.o Objects/listobject.o Objects/longobject.o Objects/dictobject.o Objects/odictobject.o Objects/memoryobject.o Objects/methodobject.o Objects/moduleobject.o Objects/namespaceobject.o Objects/object.o Objects/obmalloc.o Objects/picklebufobject.o Objects/rangeobject.o Objects/setobject.o Objects/sliceobject.o Objects/structseq.o Objects/tupleobject.o Objects/typeobject.o Objects/unicodeobject.o Objects/unicodectype.o Objects/weakrefobject.o Python/_warnings.o Python/Python-ast.o Python/asdl.o Python/ast.o Python/ast_opt.o Python/ast_unparse.o Python/bltinmodule.o Python/ceval.o Python/codecs.o Python/compile.o Python/context.o Python/dynamic_annotations.o Python/errors.o Python/frozenmain.o Python/future.o Python/getargs.o Python/getcompiler.o Python/getcopyright.o Python/getplatform.o Python/getversion.o Python/graminit.o Python/hamt.o Python/hashtable.o Python/import.o Python/importdl.o Python/initconfig.o Python/marshal.o Python/modsupport.o Python/mysnprintf.o Python/mystrtoul.o Python/pathconfig.o Python/peephole.o Python/preconfig.o Python/pyarena.o Python/pyctype.o Python/pyfpe.o Python/pyhash.o Python/pylifecycle.o Python/pymath.o Python/pystate.o Python/pythonrun.o Python/pytime.o Python/bootstrap_hash.o Python/structmember.o Python/symtable.o Python/sysmodule.o Python/thread.o Python/traceback.o Python/getopt.o Python/pystrcmp.o Python/pystrtod.o Python/pystrhex.o Python/dtoa.o Python/formatter_unicode.o Python/fileutils.o Python/dynload_shlib.o    Modules/config.o Modules/getpath.o Modules/main.o Modules/gcmodule.o Modules/posixmodule.o  Modules/errnomodule.o  Modules/pwdmodule.o  Modules/_sre.o  Modules/_codecsmodule.o  Modules/_weakref.o  Modules/_functoolsmodule.o  Modules/_operator.o  Modules/_collectionsmodule.o  Modules/_abc.o  Modules/itertoolsmodule.o  Modules/atexitmodule.o  Modules/signalmodule.o  Modules/_stat.o  Modules/timemodule.o  Modules/_threadmodule.o  Modules/_localemodule.o  Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o  Modules/faulthandler.o  Modules/_tracemalloc.o  Modules/_peg_parser.o  Modules/symtablemodule.o  Modules/xxsubtype.o Python/frozen.o   -ldl -lcrypt -lncurses -lm  -lm; \
fi
ar rcs libpython3.9.a Modules/getbuildinfo.o Parser/acceler.o Parser/grammar1.o Parser/listnode.o Parser/node.o Parser/parser.o Parser/token.o  Parser/pegen/pegen.o Parser/pegen/parse.o Parser/pegen/parse_string.o Parser/pegen/peg_api.o Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.o Objects/abstract.o Objects/accu.o Objects/boolobject.o Objects/bytes_methods.o Objects/bytearrayobject.o Objects/bytesobject.o Objects/call.o Objects/capsule.o Objects/cellobject.o Objects/classobject.o Objects/codeobject.o Objects/complexobject.o Objects/descrobject.o Objects/enumobject.o Objects/exceptions.o Objects/genericaliasobject.o Objects/genobject.o Objects/fileobject.o Objects/floatobject.o Objects/frameobject.o Objects/funcobject.o Objects/interpreteridobject.o Objects/iterobject.o Objects/listobject.o Objects/longobject.o Objects/dictobject.o Objects/odictobject.o Objects/memoryobject.o Objects/methodobject.o Objects/moduleobject.o Objects/namespaceobject.o Objects/object.o Objects/obmalloc.o Objects/picklebufobject.o Objects/rangeobject.o Objects/setobject.o Objects/sliceobject.o Objects/structseq.o Objects/tupleobject.o Objects/typeobject.o Objects/unicodeobject.o Objects/unicodectype.o Objects/weakrefobject.o Python/_warnings.o Python/Python-ast.o Python/asdl.o Python/ast.o Python/ast_opt.o Python/ast_unparse.o Python/bltinmodule.o Python/ceval.o Python/codecs.o Python/compile.o Python/context.o Python/dynamic_annotations.o Python/errors.o Python/frozenmain.o Python/future.o Python/getargs.o Python/getcompiler.o Python/getcopyright.o Python/getplatform.o Python/getversion.o Python/graminit.o Python/hamt.o Python/hashtable.o Python/import.o Python/importdl.o Python/initconfig.o Python/marshal.o Python/modsupport.o Python/mysnprintf.o Python/mystrtoul.o Python/pathconfig.o Python/peephole.o Python/preconfig.o Python/pyarena.o Python/pyctype.o Python/pyfpe.o Python/pyhash.o Python/pylifecycle.o Python/pymath.o Python/pystate.o Python/pythonrun.o Python/pytime.o Python/bootstrap_hash.o Python/structmember.o Python/symtable.o Python/sysmodule.o Python/thread.o Python/traceback.o Python/getopt.o Python/pystrcmp.o Python/pystrtod.o Python/pystrhex.o Python/dtoa.o Python/formatter_unicode.o Python/fileutils.o Python/dynload_shlib.o    Modules/config.o Modules/getpath.o Modules/main.o Modules/gcmodule.o Modules/posixmodule.o  Modules/errnomodule.o  Modules/pwdmodule.o  Modules/_sre.o  Modules/_codecsmodule.o  Modules/_weakref.o  Modules/_functoolsmodule.o  Modules/_operator.o  Modules/_collectionsmodule.o  Modules/_abc.o  Modules/itertoolsmodule.o  Modules/atexitmodule.o  Modules/signalmodule.o  Modules/_stat.o  Modules/timemodule.o  Modules/_threadmodule.o  Modules/_localemodule.o  Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o  Modules/faulthandler.o  Modules/_tracemalloc.o  Modules/_peg_parser.o  Modules/symtablemodule.o  Modules/xxsubtype.o Python/frozen.o
In function ‘assemble_lnotab’,
    inlined from ‘assemble_emit’ at Python/compile.c:5717:0,
    inlined from ‘assemble’ at Python/compile.c:6056:0:
Python/compile.c:5671: warning: writing 1 byte into a region of size 0 [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstringop-overflow=-Wstringop-overflow=8;;]
 5671 |         *lnotab++ = k;
      |
/nix/store/vf20zcyqr3qzcjhdidzk377qankcqsqa-binutils-2.35.1/bin/ld: libpython3.9.so.1.0.lto.o: warning: relocation against `PyDictValues_Type' in read-only section `.text'
/nix/store/vf20zcyqr3qzcjhdidzk377qankcqsqa-binutils-2.35.1/bin/ld: libpython3.9.so.1.0.lto.o: relocation R_X86_64_PC32 against symbol `PyBool_Type' can not be used when making a shared object; recompile with -fPIC
/nix/store/vf20zcyqr3qzcjhdidzk377qankcqsqa-binutils-2.35.1/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
ln: failed to access 'libpython3.9.so.1.0': No such file or directory
```

This should be investigated (since it should be possible), but disabling it for
now seems better than having a significant percentage of pkgsMusl broken.

Ref https://github.com/NixOS/nixpkgs/issues/131557.
2021-08-28 12:28:12 +00:00
Robert Scott
049444dc6b cpython: expose libpython.py for debugging from gdb 2021-08-19 19:37:09 +01:00
Robert Scott
55026e0783 cpython: set separateDebugInfo, explicitly stripping static libpython*.a
debug info can't be separated from a static library and would otherwise be
left in place by a separateDebugInfo build. force its removal here to save
space in output.
2021-08-19 19:37:08 +01:00
Guillaume Girol
73dee3ad4e python3: add strictDeps = true 2021-08-19 09:30:47 +02:00
Guillaume Girol
79b32fc422 python27: use strictDeps = true; 2021-08-19 09:30:47 +02:00
Guillaume Girol
36acee3820 python3: fix static build 2021-08-19 09:30:46 +02:00
Guillaume Girol
37962fc5fb python27: fix static build 2021-08-19 09:30:44 +02:00
Angus Trau
c5ee55ef26 python39: fix tkinter and decimal on aarch64-darwin 2021-08-14 09:39:38 +10:00
Frederik Rietdijk
23e348bfe2 python2 and python3: build unoptimized bytecode again
In 9d03ff5222 I made the CPython builds
reproducible. This required not generating default unoptimized bytecode.
I was under the impression the optimized bytecode would be used then,
but you need to opt-in on that. Not having the default bytecode resulted
in a significant performance hit. Therefore, bytecode is generated again
in this commit, and thereby the builds are no longer reproducible.

https://bugs.python.org/issue29708
2021-07-30 09:27:42 +02:00
Vladimír Čunát
1f2b1f3bb0
cpython: restrict enableLTO to Linux
Both darwin platforms would fail:
  https://hydra.nixos.org/build/147600631
  https://hydra.nixos.org/build/147646604
And as it seems to be a risky feature, I switched other platforms along
(though none are on the official build farm)
2021-07-16 10:32:33 +02:00
Martin Weinelt
fac5757eec
cpython: disable no-semantic-interposition with older clang versions
> clang-7: error: unknown argument: '-fno-semantic-interposition'

This primarily affects current darwin builds, but as soon as they
migrate to a newer clang version they will immediately start benefitting
from this change.
2021-07-09 22:24:43 +02:00
Jonathan Ringer
07571e7ae5 python3: only enable LTO for 64bit builds
Avoid failures with 32bit builds:
```
cc1: error: LTO support has not been enabled in this configuration
```
2021-07-05 12:34:02 -07:00
Andreas Rammhold
1e47dd9cb8 cpython: Enable LTO on all builds as it doesn't break reproducibility
LTO allows us to optimise the binaries we are shipping a bit further
than just with the regular -Ox and other compiler flags. It also is
deterministic and doesn't harm our reproducibility efforts while
providing us with up to 10% performance gain (and sometimes slightly
slower). See the table below for a comparsion of this version with the
Python 3.9 build that sets -fno-semantic-interposition.

+-------------------------+--------------------+------------------------+--------------+------------------------+
| Benchmark               | py39-nsip.nix.json | py39-nsip-lto.nix.json | Change       | Significance           |
+=========================+====================+========================+==============+========================+
| 2to3                    | 642 ms             | 620 ms                 | 1.03x faster | Significant (t=12.04)  |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| chameleon               | 14.6 ms            | 14.4 ms                | 1.02x faster | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| chaos                   | 182 ms             | 182 ms                 | 1.00x slower | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| crypto_pyaes            | 175 ms             | 172 ms                 | 1.02x faster | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| deltablue               | 11.2 ms            | 11.2 ms                | 1.00x faster | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| django_template         | 82.0 ms            | 81.4 ms                | 1.01x faster | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| dulwich_log             | 101 ms             | 99.8 ms                | 1.01x faster | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| fannkuch                | 634 ms             | 638 ms                 | 1.01x slower | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| float                   | 176 ms             | 189 ms                 | 1.08x slower | Significant (t=-4.30)  |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| go                      | 366 ms             | 365 ms                 | 1.00x faster | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| hexiom                  | 14.9 ms            | 15.1 ms                | 1.01x slower | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| json_dumps              | 18.7 ms            | 18.5 ms                | 1.01x faster | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| json_loads              | 37.9 us            | 37.3 us                | 1.02x faster | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| logging_format          | 14.2 us            | 14.3 us                | 1.01x slower | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| logging_silent          | 305 ns             | 313 ns                 | 1.02x slower | Significant (t=-3.91)  |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| logging_simple          | 13.0 us            | 13.2 us                | 1.01x slower | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| mako                    | 24.7 ms            | 23.3 ms                | 1.06x faster | Significant (t=10.74)  |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| meteor_contest          | 130 ms             | 128 ms                 | 1.01x faster | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| nbody                   | 201 ms             | 201 ms                 | 1.00x faster | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| nqueens                 | 152 ms             | 154 ms                 | 1.01x slower | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| pathlib                 | 26.3 ms            | 26.2 ms                | 1.01x faster | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| pickle                  | 13.1 us            | 13.7 us                | 1.05x slower | Significant (t=-10.36) |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| pickle_dict             | 26.6 us            | 27.1 us                | 1.02x slower | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| pickle_list             | 4.34 us            | 4.31 us                | 1.01x faster | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| pickle_pure_python      | 738 us             | 759 us                 | 1.03x slower | Significant (t=-5.26)  |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| pidigits                | 181 ms             | 181 ms                 | 1.00x faster | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| pyflate                 | 959 ms             | 974 ms                 | 1.02x slower | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| python_startup          | 34.0 ms            | 31.4 ms                | 1.08x faster | Significant (t=29.75)  |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| python_startup_no_site  | 15.3 ms            | 14.5 ms                | 1.06x faster | Significant (t=17.58)  |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| raytrace                | 849 ms             | 846 ms                 | 1.00x faster | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| regex_compile           | 261 ms             | 261 ms                 | 1.00x faster | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| regex_dna               | 187 ms             | 221 ms                 | 1.18x slower | Significant (t=-46.94) |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| regex_effbot            | 3.66 ms            | 3.98 ms                | 1.09x slower | Significant (t=-18.55) |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| regex_v8                | 29.7 ms            | 29.3 ms                | 1.01x faster | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| richards                | 113 ms             | 110 ms                 | 1.03x faster | Significant (t=3.47)   |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| scimark_fft             | 592 ms             | 590 ms                 | 1.00x faster | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| scimark_lu              | 253 ms             | 265 ms                 | 1.05x slower | Significant (t=-8.97)  |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| scimark_monte_carlo     | 170 ms             | 177 ms                 | 1.04x slower | Significant (t=-4.96)  |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| scimark_sor             | 310 ms             | 315 ms                 | 1.02x slower | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| scimark_sparse_mat_mult | 8.36 ms            | 8.33 ms                | 1.00x faster | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| spectral_norm           | 232 ms             | 229 ms                 | 1.02x faster | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| sqlalchemy_declarative  | 185 ms             | 183 ms                 | 1.01x faster | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| sqlalchemy_imperative   | 27.4 ms            | 27.6 ms                | 1.01x slower | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| sqlite_synth            | 4.73 us            | 4.73 us                | 1.00x faster | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| sympy_expand            | 813 ms             | 819 ms                 | 1.01x slower | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| sympy_integrate         | 31.6 ms            | 31.8 ms                | 1.01x slower | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| sympy_str               | 477 ms             | 479 ms                 | 1.00x slower | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| sympy_sum               | 245 ms             | 247 ms                 | 1.01x slower | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| telco                   | 11.3 ms            | 11.4 ms                | 1.00x slower | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| tornado_http            | 172 ms             | 172 ms                 | 1.00x slower | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| unpack_sequence         | 56.2 ns            | 51.2 ns                | 1.10x faster | Significant (t=2.50)   |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| unpickle                | 19.8 us            | 19.5 us                | 1.02x faster | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| unpickle_list           | 5.75 us            | 5.75 us                | 1.00x faster | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| unpickle_pure_python    | 524 us             | 522 us                 | 1.01x faster | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| xml_etree_generate      | 148 ms             | 148 ms                 | 1.00x slower | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| xml_etree_iterparse     | 129 ms             | 131 ms                 | 1.02x slower | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| xml_etree_parse         | 179 ms             | 177 ms                 | 1.01x faster | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
| xml_etree_process       | 118 ms             | 119 ms                 | 1.00x slower | Not significant        |
+-------------------------+--------------------+------------------------+--------------+------------------------+
2021-07-05 12:34:02 -07:00
Andreas Rammhold
322eb3596b cpython: add enableNoSemanticInterposition flag
This flags enables the -fno-semantic-interposition compiler flag for all
our cpython builds by default. It can be disabled by overriding the
enableNoSemanticInterposition attribute.

This CFLAG has the impact that our python code runs up to 23% faster
than previously. See the pyperformance benchmark results below.

The only downside that exists is that we can no longer override
libpython symbols via LD_PRELOAD when calling the python interpreter. If
a user needs they can disable the newly introduced flag and use that
instead. However those situations should be rare.

The Fedora Project did the equivalent change in their Fedora 32 release
(and haven't reverted it yet). They wrote a nice [wiki page] about the
ups and downs of this change. I recommend reading that.

Benchmark results of running Python 3.9 before and after this change:

+-------------------------+---------------+--------------------+--------------+------------------------+
| Benchmark               | py39.nix.json | py39-nsip.nix.json | Change       | Significance           |
+=========================+===============+====================+==============+========================+
| 2to3                    | 666 ms        | 642 ms             | 1.04x faster | Significant (t=12.73)  |
+-------------------------+---------------+--------------------+--------------+------------------------+
| chameleon               | 15.0 ms       | 14.6 ms            | 1.03x faster | Significant (t=4.70)   |
+-------------------------+---------------+--------------------+--------------+------------------------+
| chaos                   | 198 ms        | 182 ms             | 1.09x faster | Significant (t=13.73)  |
+-------------------------+---------------+--------------------+--------------+------------------------+
| crypto_pyaes            | 185 ms        | 175 ms             | 1.06x faster | Significant (t=9.70)   |
+-------------------------+---------------+--------------------+--------------+------------------------+
| deltablue               | 12.3 ms       | 11.2 ms            | 1.10x faster | Significant (t=14.45)  |
+-------------------------+---------------+--------------------+--------------+------------------------+
| django_template         | 85.1 ms       | 82.0 ms            | 1.04x faster | Significant (t=6.61)   |
+-------------------------+---------------+--------------------+--------------+------------------------+
| dulwich_log             | 102 ms        | 101 ms             | 1.01x faster | Not significant        |
+-------------------------+---------------+--------------------+--------------+------------------------+
| fannkuch                | 670 ms        | 634 ms             | 1.06x faster | Significant (t=15.87)  |
+-------------------------+---------------+--------------------+--------------+------------------------+
| float                   | 182 ms        | 176 ms             | 1.03x faster | Significant (t=7.32)   |
+-------------------------+---------------+--------------------+--------------+------------------------+
| go                      | 393 ms        | 366 ms             | 1.07x faster | Significant (t=17.63)  |
+-------------------------+---------------+--------------------+--------------+------------------------+
| hexiom                  | 15.8 ms       | 14.9 ms            | 1.06x faster | Significant (t=13.81)  |
+-------------------------+---------------+--------------------+--------------+------------------------+
| json_dumps              | 19.3 ms       | 18.7 ms            | 1.03x faster | Significant (t=7.46)   |
+-------------------------+---------------+--------------------+--------------+------------------------+
| json_loads              | 38.4 us       | 37.9 us            | 1.01x faster | Not significant        |
+-------------------------+---------------+--------------------+--------------+------------------------+
| logging_format          | 15.0 us       | 14.2 us            | 1.05x faster | Significant (t=6.32)   |
+-------------------------+---------------+--------------------+--------------+------------------------+
| logging_silent          | 328 ns        | 305 ns             | 1.07x faster | Significant (t=8.85)   |
+-------------------------+---------------+--------------------+--------------+------------------------+
| logging_simple          | 13.8 us       | 13.0 us            | 1.06x faster | Significant (t=10.77)  |
+-------------------------+---------------+--------------------+--------------+------------------------+
| mako                    | 25.2 ms       | 24.7 ms            | 1.02x faster | Not significant        |
+-------------------------+---------------+--------------------+--------------+------------------------+
| meteor_contest          | 133 ms        | 130 ms             | 1.03x faster | Significant (t=3.59)   |
+-------------------------+---------------+--------------------+--------------+------------------------+
| nbody                   | 222 ms        | 201 ms             | 1.10x faster | Significant (t=26.85)  |
+-------------------------+---------------+--------------------+--------------+------------------------+
| nqueens                 | 161 ms        | 152 ms             | 1.06x faster | Significant (t=8.84)   |
+-------------------------+---------------+--------------------+--------------+------------------------+
| pathlib                 | 28.4 ms       | 26.3 ms            | 1.08x faster | Significant (t=11.85)  |
+-------------------------+---------------+--------------------+--------------+------------------------+
| pickle                  | 13.8 us       | 13.1 us            | 1.06x faster | Significant (t=10.84)  |
+-------------------------+---------------+--------------------+--------------+------------------------+
| pickle_dict             | 32.7 us       | 26.6 us            | 1.23x faster | Significant (t=32.43)  |
+-------------------------+---------------+--------------------+--------------+------------------------+
| pickle_list             | 4.39 us       | 4.34 us            | 1.01x faster | Not significant        |
+-------------------------+---------------+--------------------+--------------+------------------------+
| pickle_pure_python      | 782 us        | 738 us             | 1.06x faster | Significant (t=15.71)  |
+-------------------------+---------------+--------------------+--------------+------------------------+
| pidigits                | 184 ms        | 181 ms             | 1.01x faster | Not significant        |
+-------------------------+---------------+--------------------+--------------+------------------------+
| pyflate                 | 1.02 sec      | 959 ms             | 1.07x faster | Significant (t=21.13)  |
+-------------------------+---------------+--------------------+--------------+------------------------+
| python_startup          | 34.3 ms       | 34.0 ms            | 1.01x faster | Not significant        |
+-------------------------+---------------+--------------------+--------------+------------------------+
| python_startup_no_site  | 15.5 ms       | 15.3 ms            | 1.01x faster | Not significant        |
+-------------------------+---------------+--------------------+--------------+------------------------+
| raytrace                | 912 ms        | 849 ms             | 1.07x faster | Significant (t=11.21)  |
+-------------------------+---------------+--------------------+--------------+------------------------+
| regex_compile           | 273 ms        | 261 ms             | 1.05x faster | Significant (t=5.82)   |
+-------------------------+---------------+--------------------+--------------+------------------------+
| regex_dna               | 188 ms        | 187 ms             | 1.00x faster | Not significant        |
+-------------------------+---------------+--------------------+--------------+------------------------+
| regex_effbot            | 3.37 ms       | 3.66 ms            | 1.09x slower | Significant (t=-16.12) |
+-------------------------+---------------+--------------------+--------------+------------------------+
| regex_v8                | 29.8 ms       | 29.7 ms            | 1.01x faster | Not significant        |
+-------------------------+---------------+--------------------+--------------+------------------------+
| richards                | 119 ms        | 113 ms             | 1.05x faster | Significant (t=5.71)   |
+-------------------------+---------------+--------------------+--------------+------------------------+
| scimark_fft             | 625 ms        | 592 ms             | 1.06x faster | Significant (t=19.64)  |
+-------------------------+---------------+--------------------+--------------+------------------------+
| scimark_lu              | 273 ms        | 253 ms             | 1.08x faster | Significant (t=16.68)  |
+-------------------------+---------------+--------------------+--------------+------------------------+
| scimark_monte_carlo     | 186 ms        | 170 ms             | 1.10x faster | Significant (t=14.70)  |
+-------------------------+---------------+--------------------+--------------+------------------------+
| scimark_sor             | 330 ms        | 310 ms             | 1.07x faster | Significant (t=11.89)  |
+-------------------------+---------------+--------------------+--------------+------------------------+
| scimark_sparse_mat_mult | 9.03 ms       | 8.36 ms            | 1.08x faster | Significant (t=17.71)  |
+-------------------------+---------------+--------------------+--------------+------------------------+
| spectral_norm           | 247 ms        | 232 ms             | 1.06x faster | Significant (t=14.64)  |
+-------------------------+---------------+--------------------+--------------+------------------------+
| sqlalchemy_declarative  | 194 ms        | 185 ms             | 1.04x faster | Significant (t=4.80)   |
+-------------------------+---------------+--------------------+--------------+------------------------+
| sqlalchemy_imperative   | 28.2 ms       | 27.4 ms            | 1.03x faster | Significant (t=3.80)   |
+-------------------------+---------------+--------------------+--------------+------------------------+
| sqlite_synth            | 4.89 us       | 4.73 us            | 1.03x faster | Significant (t=10.60)  |
+-------------------------+---------------+--------------------+--------------+------------------------+
| sympy_expand            | 833 ms        | 813 ms             | 1.02x faster | Significant (t=4.82)   |
+-------------------------+---------------+--------------------+--------------+------------------------+
| sympy_integrate         | 33.0 ms       | 31.6 ms            | 1.05x faster | Significant (t=6.47)   |
+-------------------------+---------------+--------------------+--------------+------------------------+
| sympy_str               | 490 ms        | 477 ms             | 1.03x faster | Significant (t=7.58)   |
+-------------------------+---------------+--------------------+--------------+------------------------+
| sympy_sum               | 254 ms        | 245 ms             | 1.04x faster | Significant (t=7.82)   |
+-------------------------+---------------+--------------------+--------------+------------------------+
| telco                   | 11.6 ms       | 11.3 ms            | 1.03x faster | Significant (t=5.62)   |
+-------------------------+---------------+--------------------+--------------+------------------------+
| tornado_http            | 175 ms        | 172 ms             | 1.02x faster | Not significant        |
+-------------------------+---------------+--------------------+--------------+------------------------+
| unpack_sequence         | 51.4 ns       | 56.2 ns            | 1.09x slower | Significant (t=-2.40)  |
+-------------------------+---------------+--------------------+--------------+------------------------+
| unpickle                | 20.3 us       | 19.8 us            | 1.02x faster | Significant (t=4.09)   |
+-------------------------+---------------+--------------------+--------------+------------------------+
| unpickle_list           | 5.41 us       | 5.75 us            | 1.06x slower | Significant (t=-26.56) |
+-------------------------+---------------+--------------------+--------------+------------------------+
| unpickle_pure_python    | 544 us        | 524 us             | 1.04x faster | Significant (t=6.47)   |
+-------------------------+---------------+--------------------+--------------+------------------------+
| xml_etree_generate      | 154 ms        | 148 ms             | 1.04x faster | Significant (t=7.98)   |
+-------------------------+---------------+--------------------+--------------+------------------------+
| xml_etree_iterparse     | 130 ms        | 129 ms             | 1.01x faster | Not significant        |
+-------------------------+---------------+--------------------+--------------+------------------------+
| xml_etree_parse         | 178 ms        | 179 ms             | 1.00x slower | Not significant        |
+-------------------------+---------------+--------------------+--------------+------------------------+
| xml_etree_process       | 123 ms        | 118 ms             | 1.04x faster | Significant (t=10.22)  |
+-------------------------+---------------+--------------------+--------------+------------------------+

[wiki page]: https://fedoraproject.org/wiki/Changes/PythonNoSemanticInterpositionSpeedup
2021-07-05 12:34:02 -07:00
Martin Weinelt
4fa69858d9
cpython: fix permissions on venv activation scripts
Previously these ended up without u+w permissions which meant they could
not be regenerated, which was hugely annoying when these venvs were for
example created and recreated in a nix-shell.
2021-06-28 03:15:04 +02:00
Mario Rodas
1b2f9c0eaf python310: fix build on darwin 2021-04-20 04:20:00 +00:00
Ivan Babrou
51f6036e41 python2: only pass -msse2 on x86_64-darwin, not any darwin 2021-05-14 09:15:03 -07:00
Anderson Torres
fea3171893
Merge pull request #118403 from dotlambda/CVE-2021-23336
python27: fix CVE-2021-23336
2021-04-12 18:44:52 -03:00
Sandro Jäckel
3453b89f4b
lzma: deprecate alias 2021-04-04 19:49:52 +02:00
Robert Schütz
fa410ea633 python27: fix CVE-2021-23336
From the archive `python-gentoo-patches-2.7.18_p8.tar.xz` found at
https://dev.gentoo.org/~mgorny/dist/python/, I copied
`0024-3.6-bpo-42967-only-use-as-a-query-string-separator-G.patch`.
2021-04-03 15:10:01 +02:00
Sandro Jäckel
b45c06fde8
cpython: allow $out reference again
This regression got introduced with 738746a34b
2021-03-15 03:20:32 +01:00
Frederik Rietdijk
738746a34b python3: express references to keep as a nix list 2021-03-14 17:00:59 +01:00
Frederik Rietdijk
5b1abe5dd2 python3: mimetypesSupport is optional 2021-03-14 15:45:15 +01:00
nicoo
faf0f8a8a4 cpython: Pull in the mime-types database
Closes #113901
2021-03-14 15:45:15 +01:00
Frederik Rietdijk
7617b03403 python39: hardcode path to tzdata
Python 3.9 has a new module `zoneinfo` which requires tzdata. By default
it searches TZPATH for folders containing `zoneinfo`.

This commit makes the dependency on tzdata pure.
2021-03-13 14:05:41 +01:00
Frederik Rietdijk
9d03ff5222 python: reproducible builds
Achieve reproducible builds of the interpreter. Note this meant
disabling optimizations again.
2021-03-13 13:11:50 +01:00
Ivan Babrou
b00c7c2d1d python37, python2: remove win64 workaround to fix aarch64-darwin
The issue manifests itself as the following on `aarch64-darwin`:

```
>>> import ctypes
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/nix/store/i8cq0xrjirz1rcp65wzcyhj6ypzlw9il-python3-3.7.10/lib/python3.7/ctypes/__init__.py", line 551, in <module>
    _reset_cache()
  File "/nix/store/i8cq0xrjirz1rcp65wzcyhj6ypzlw9il-python3-3.7.10/lib/python3.7/ctypes/__init__.py", line 273, in _reset_cache
    CFUNCTYPE(c_int)(lambda: None)
MemoryError
```

The commit we backport is included in Python 3.8, and it reverts
the change that was introduced all the way back in Python 2.7.
2021-03-03 16:02:07 -08:00
Martin Weinelt
92087cb170 python37: 3.7.9 -> 3.7.10, fixup patches 2021-02-20 12:13:07 +01:00
Martin Weinelt
85cde0d60f python27: Fix CVE-2021-3177
Thanks to the Gentoo team maintaining a fork of python2¹ we can easily
apply their backported patch for this security vulnerability.

[1] https://gitweb.gentoo.org/fork/cpython.git/
2021-02-20 10:03:11 +01:00
Ben Siraphob
001c0cbe54 pkgs/development/interpreters: stdenv.lib -> lib 2021-01-23 20:29:03 +07:00
Peter Woodman
858eebe1f9 cpython: fix extensions when using a musl toolchain 2021-01-22 23:56:19 +01:00
Jan Tojnar
b813710c04
Merge branch 'master' into staging-next 2021-01-14 02:24:17 +01:00
Fabian Möller
07e7cea102 python36: enable ctypes.util.find_library patch 2021-01-13 13:13:02 +01:00
Frederik Rietdijk
7c61ecbefd Revert "Revert "python: 3.8.6 -> 3.8.7.""
This was originally reverted because of an invalid patch.
This has been fixed and now we want this update again.

This reverts commit e1ed9b3b08.
2021-01-09 13:12:44 +01:00
github-actions[bot]
7aced83bf9
Merge staging-next into staging 2021-01-08 12:29:39 +00:00
Orivej Desh
349585e778 python2: fix ctypes.util.find_library with gcc10
Fixes #108243
2021-01-08 11:19:39 +01:00
Frederik Rietdijk
5c8df2235a python3: don't use sysconfigdataHook on darwin
Resolves issue when building wheels which is a regression introduced by
1a65c5df5f

```
AssertionError: would build wheel with unsupported tag ('cp38', 'cp38',
'darwin_x86_64')
```
2021-01-08 09:34:36 +01:00
Jan Tojnar
0ea0dacc20
Merge branch 'staging-next' into staging 2021-01-07 13:06:41 +01:00