[issue46645] Portable python3 shebang for Windows, macOS, and Linux

2022-02-04 Thread Josh Triplett
Josh Triplett added the comment: Correction to the above evaluation of `#!/usr/bin/env python3`, based on some retesting on Windows systems: The failure case we encounter reasonably often involves the official Python installer for Windows, but applies specifically in the case of third-party

[issue46645] Portable python3 shebang for Windows, macOS, and Linux

2022-02-04 Thread Josh Triplett
New submission from Josh Triplett : I'm writing this issue on behalf of the Rust project. The build system for the Rust compiler is a Python 3 script `x.py`, which orchestrates the build process for a user even if they don't already have Rust installed. (For instance, `x.py build`, `x.py

[issue42799] Please document fnmatch LRU cache size (256) and suggest alternatives

2020-12-31 Thread Josh Triplett
New submission from Josh Triplett : fnmatch translates shell patterns to regexes, using an LRU cache of 256 elements. The documentation doesn't mention the cache size, just "They cache the compiled regular expressions for speed.". Without this knowledge, it's possible to get path

[issue27450] bz2: BZ2File should expose compression level as an attribute

2016-09-04 Thread Josh Triplett
Josh Triplett added the comment: As part of a reproducible build project, to allow recompressing a file with the same compression level previously used. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue27451] gzip.py: Please save more of the gzip header for later examination

2016-07-04 Thread Josh Triplett
New submission from Josh Triplett: GzipFile currently reads and discards various fields from the gzip header, such as the original filename and timestamp. Please consider reading all the fields of the gzip header into fields of the GzipFile instance, so that users of GzipFile can access

[issue27450] bz2: BZ2File should expose compression level as an attribute

2016-07-04 Thread Josh Triplett
New submission from Josh Triplett: (This exists in both Python 3 and Python 2.) When opening an existing .bz2 file with BZ2File, I'd like to have access to the compression level, so that I don't have to manually parse the file's header to get it. BZ2File could provide the compression level

[issue12556] Disable size checks in mmap.mmap()

2014-05-12 Thread Josh Triplett
Josh Triplett added the comment: This rejection is indeed problematic. If mmap.mmap receives an explicit size, checking that size against stat will break on devices or special files. It's perfectly reasonable that mmap.mmap's automatic logic when passed length=0 (to map the entire file

[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)

2012-04-09 Thread Josh Triplett
Josh Triplett j...@joshtriplett.org added the comment: I currently use Python 2.7, and I'd like to make use of memoryview. Specifically, I work on BITS (http://biosbits.org/), which runs Python in ring 0 as part of GRUB, and I'd like to use memoryview to give Python access to data

[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)

2012-04-09 Thread Josh Triplett
Josh Triplett j...@joshtriplett.org added the comment: I currently use Python 2.7, and I'd like to make use of memoryview. Specifically, I work on BITS (http://biosbits.org/), which runs Python in ring 0 as part of GRUB, and I'd like to use memoryview to give Python access to data

[issue12603] pydoc.synopsis breaks if filesystem returns mtime of 0

2011-07-22 Thread Josh Triplett
Josh Triplett j...@joshtriplett.org added the comment: The current behavior of pydoc will cause synopsis to always incorrectly return None as the synopsis for any module with mtime == 0. Both of the proposed fixes will fix that bug without affecting any case where mtime != 0, so I don't

[issue12603] pydoc.synopsis breaks if filesystem returns mtime of 0 (common for filesystems without mtime)

2011-07-21 Thread Josh Triplett
New submission from Josh Triplett j...@joshtriplett.org: In Python 2.7.2, pydoc.py's synopsis contains this code implementing a cache: mtime = os.stat(filename).st_mtime lastupdate, result = cache.get(filename, (0, None)) if lastupdate mtime: Many filesystems don't have any

[issue12604] VTRACE macro in _sre.c should use do {} while (0)

2011-07-21 Thread Josh Triplett
New submission from Josh Triplett j...@joshtriplett.org: In _sre.c, the VTRACE macro normally gets defined to nothing. It later gets used as the body of control structures such as else without braces, which causes many compilers to warn (to catch stray semicolons like else;). This makes

[issue12082] Python/import.c still references fstat even with DONT_HAVE_FSTAT/!HAVE_FSTAT

2011-05-31 Thread Josh Triplett
Josh Triplett j...@joshtriplett.org added the comment: Rather than checking for a directory, how about just opening foo/__init__.py, and if that fails opening foo.py? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12082

[issue12082] Python/import.c still references fstat even with DONT_HAVE_FSTAT/!HAVE_FSTAT

2011-05-30 Thread Josh Triplett
Josh Triplett j...@joshtriplett.org added the comment: Given that GRUB doesn't support writing to filesystems at all, I already have to set Py_DontWriteBytecodeFlag, so disabling .pyc/.pyo entirely would work fine for my use case. -- ___ Python

[issue12082] Python/import.c still references fstat even with DONT_HAVE_FSTAT/!HAVE_FSTAT

2011-05-27 Thread Josh Triplett
Josh Triplett j...@joshtriplett.org added the comment: GRUB's filesystem drivers don't support reading mtime. And no, no form of stat() function exists, f or otherwise. On a related note, without HAVE_STAT, import.c can't import package modules at all, since it uses stat to check in advance

[issue12082] Python/import.c still references fstat even with DONT_HAVE_FSTAT/!HAVE_FSTAT

2011-05-15 Thread Josh Triplett
New submission from Josh Triplett j...@joshtriplett.org: Even if pyconfig.h defines DONT_HAVE_STAT and DONT_HAVE_FSTAT (which prevents the definitions of HAVE_STAT and HAVE_FSTAT), Python still references fstat in Python/import.c, along with struct stat and constants like S_IXUSR. I ran

[issue12083] Compile-time option to avoid writing files, including generated bytecode

2011-05-15 Thread Josh Triplett
New submission from Josh Triplett j...@joshtriplett.org: PEP 304 provides a runtime option to avoid saving generating bytecode files. However, for embedded usage, it would help to have a compile-time option to remove all the file-writing code entirely, hardcoding PYTHONBYTECODEBASE=. I ran