Nick Coghlan added the comment:
The ``sys`` import gets cleared as well (accidentally omitted from the previous
comment):
```
>>> sys
Traceback (most recent call last):
File "", line 1, in
NameError: name 'sys' is not defined
```
--
___
Nick Coghlan added the comment:
Additional info showing the module getting reset back to the state of a freshly
created module namespace:
```
>>> dir()
['__annotations__', '__builtins__', '__doc__', '__loader__', '__name__',
'__package__', '__spec__']
>>> __builtins
New submission from Nick Coghlan :
While trying to create an example for a pickle bug discussion, I deliberately
dropped `__main__` out of sys.modules, and the REPL session lost all of its
runtime state.
Simplified reproducer:
```
>>> import sys
>>> mod = sy
Nick Davies added the comment:
My preference would actually be number 3 because:
1: I agree that this isn't really a safe option because it could slow things
down (possibly a lot)
2: I haven't found this to be rare in my situation but I am not sure how
common my setup is. We have
Change by Nick Davies :
--
type: -> behavior
versions: +Python 3.6
___
Python tracker
<https://bugs.python.org/issue36607>
___
___
Python-bugs-list mai
New submission from Nick Davies :
This problem was identified in https://bugs.python.org/issue34970 but I think
the fix might have been incorrect. The theory in issue34970 was that GC was
causing the weakrefset for `all_tasks` to change during iteration. However
Weakset provides
Nick Coghlan added the comment:
I was going to note that the algorithm Anthony has pursued here is the same one
we already use for the list constructor and list.extend(), but Inada-san
already pointed that out :)
While length_hint is allowed to be somewhat inaccurate, we do expect
Nick Coghlan added the comment:
Retitled the issue using the `--mainpath` spelling, as I wanted to link to it
from the PEP 582 discussion, and that's my current favourite from the various
ideas I've had since first filing the issue.
(I decided I didn't like `--basepath` because we already
Nick Coghlan added the comment:
Aye, let's close this for now - swapping streams out has enough other problems
with stale references to the original stream that using reconfigure() to update
the existing stream in place is usually going to be the better option.
--
resolution
Nick Coghlan added the comment:
I'm inclined to leave 3.7 alone unless/until we get an actual bug report for
the current behaviour - if an embedder finds that it just straight up doesn't
work for them, then they can either resort to tinkering with the private APIs
(since they won't change
Nick Coghlan added the comment:
Piotr: does it always jump out, or does it only jump out if the relevant module
has already been imported?
(The tests for walk_packages are relatively weak and never generate conflicting
names, so it's entirely plausible that there are caching side effects
Nick Coghlan added the comment:
The recommended handling in the article that Serhiy mentions is to strip the
leading zeroes, which the ipaddress module will still do - it's only being made
more tolerant on input. That means it will become usable as a prefilter step
(pass string
Nick Coghlan added the comment:
Oops, this covers more than just modulefinder - reopening until the other
remaining uses of the imp module have been removed.
--
resolution: fixed ->
stage: resolved -> needs patch
status: closed -> open
_
Nick Coghlan added the comment:
Fixed for Python 3.8 via the patch for #35936.
--
nosy: +ncoghlan
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.8 -Python 3.6
___
Python tracke
Nick Coghlan added the comment:
Fixed for Python 3.8 via the patch for #35936. We won't be backporting that
patch as it also migrates modulefinder from the deprecated imp API to the
supported importlib one, and is hence considered overly intrusive for a bug fix
release
Nick Coghlan added the comment:
Fixed for Python 3.8 via the patch for #35936. We won't be backporting that
patch as it also migrates modulefinder from the deprecated imp API to support
importlib one, and is hence considered overly intrusive for a bug fix release.
--
resolution
Nick Coghlan added the comment:
New changeset 9d7b2c0909b78800d1376fd696f73824ea680463 by Nick Coghlan (Brandt
Bucher) in branch 'master':
bpo-35936: Updates to modulefinder (GH-11787)
https://github.com/python/cpython/commit/9d7b2c0909b78800d1376fd696f73824ea680463
Nick Coghlan added the comment:
Thanks Brandt!
I'll also go back and close #17396, #35376, and #25160
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Nick Coghlan added the comment:
Thanks for the technical clarification Lars, and for the docs update C.A.M.
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Nick Coghlan added the comment:
New changeset 89a894403cfa880d7f9d1d67070f61456d14cbde by Nick Coghlan (CAM
Gerlach) in branch 'master':
bpo-30661: Improve docs for tarfile pax change and effect on shutil (GH-12635)
https://github.com/python/cpython/commit
Nick Coghlan added the comment:
I've merged the change for Python 3.8 (thanks Joel!).
I'm not sure whether to classify it as an enhancement or as an interoperability
bug fix, though, so I've put the status to pending and added Ned to the nosy
list to get his thoughts as the Python 3.7 RM
Nick Coghlan added the comment:
New changeset e653d4d8e820a7a004ad399530af0135b45db27a by Nick Coghlan (Joel
Croteau) in branch 'master':
bpo-36384: Remove check for leading zeroes in IPv4 addresses (GH-12577)
https://github.com/python/cpython/commit/e653d4d8e820a7a004ad399530af0135b45db27a
Nick Coghlan added the comment:
I think Caleb's "sample_before_and_after" idea hints that this may be an idea
that could benefit from the ExitStack treatment where contextlib provides a
building block that handles the interaction with the context management
machinery, with the doc
Nick Coghlan added the comment:
Thanks for sorting this out, Victor!
--
resolution: -> fixed
___
Python tracker
<https://bugs.python.org/issue36236>
___
_
Nick Coghlan added the comment:
If I recall correctly, it's the generator destructor that handles throwing in
``GeneratorExit`` to get the generator to terminate. So this code can resurrect
a generator as it's being collected by the GC:
def resurrecting(resurrected):
self
Nick Coghlan added the comment:
Victor Stinner added a great many regression tests in this area for Python 3.7+
--
___
Python tracker
<https://bugs.python.org/issue16
Nick Coghlan added the comment:
Aye, I agree that changing the default resolves the feature request here. I've
recategorised this as a documentation issue, as the initial PR only changed the
`tarfile` documentation, so the impact on `shutil` isn't obvious.
So the changes needed
Nick Coghlan added the comment:
I think test_embed would be the right home for this, as there's an existing
test case there for subinterpreter lifecycles and repeated init/finalize
cycles:
https://github.com/python/cpython/blob/ddbb978e1065dde21d1662386b26ded359f4b16e/Programs/_testembed.c
Nick Coghlan added the comment:
This is not a bug - to enable function level optimisations, the compiler must
be able to see all local variable names at compile time.
In Python 2.x the exec statement implementation included special code to allow
even function local variables to be rebound
, University of Glasgow
Joe Gibbs Politz, University of California San Diego
Juan Fumero, The University of Manchester
Julien Ponge, Red Hat
Mandana Vaziri, IBM Research
Manuel Serrano, Inria
Marc Feeley, Université de Montréal
Mark Marron, Microsoft Research
Na Meng, Virginia Tech
Nick Papoulias
Nick Coghlan added the comment:
Omitting it from sys.path in that case makes sense to me, but I'm not sure what
sys.argv[0] should be set to.
--
___
Python tracker
<https://bugs.python.org/issue36
Nick Coghlan added the comment:
I've merged Yasser's PR (thank you!), but in the review discussion for that, we
noticed something else: the `total_seconds()` documentation mentions the
floating point dynamic resolution problem, but doesn't mention using `//` or
`divmod()` as the fix
Nick Coghlan added the comment:
New changeset f40b4a0b6277b2779b9ded3736325489f2af93e4 by Nick Coghlan (Yasser
A) in branch 'master':
bpo-36138: Clarify docs about converting datetime.timedelta to scalars.
(GH-12137)
https://github.com/python/cpython/commit
Nick Coghlan added the comment:
Just noting that https://bugs.python.org/issue14803 is probably our most
comprehensive discussion of the coverage use case for arbitrary pre-__main__
code execution.
Steve also made a comment above about potentially turning encodings into a
namespace package
Nick Coghlan added the comment:
Victor and I were discussing the appropriate behaviour for the "What do we do
if _Py_PreInitialize() hasn't been called?" case, and Victor pointed out that
the potential for mojibake provides a solid rationale for going back to the
Python 3.6
New submission from Nick Sung :
Dear Python Community,
We’ve found a vulnerability in cpython Lib and already received a cve number
(CVE-2019-9674)
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-9674
We also have a patch for this vulnerability, please tell us what to do next.
Since
Nick Coghlan added the comment:
I went ahead and merged Lysandros's new FAQ entry (Thank you Lysandros!), as
having some level of documentation for this notation is markedly better than
the previous "none at all", and the PR added cross-references from the builtins
and inspect m
Nick Coghlan added the comment:
New changeset 1aeeaeb79efa4de41f97b58547e23c2965ecabc5 by Nick Coghlan
(Lysandros Nikolaou) in branch 'master':
bpo-21314: Add a FAQ entry about positional only parameters (GH-10641)
https://github.com/python/cpython/commit
Change by Nick Coghlan :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
type: -> enhancement
___
Python tracker
<https://bugs.python
Nick Coghlan added the comment:
Just noting that PEP 499 covers adding modules executed with `-m` to
`sys.modules` under their real name in addition to `__main__`.
--
___
Python tracker
<https://bugs.python.org/issue19
New submission from Nick Coghlan :
https://docs.python.org/3/c-api/init.html#c.Py_EndInterpreter states that
"Py_FinalizeEx() will destroy all sub-interpreters that haven’t been explicitly
destroyed at that point."
As discussed in https://github.com/hexchat/hexchat/issues/2237,
Nick Coghlan added the comment:
They weren't *intended* to change it, and didn't in the original implementation
of the PEP, but they do in the as-shipped Python 3.7 implementation, and I
abandoned my attempts to revert to the as-designed behaviour as impractical
given the other changes made
Nick Coghlan added the comment:
PEP 432 tweaked: https://github.com/python/peps/pull/904/files
--
___
Python tracker
<https://bugs.python.org/issue36
Nick Coghlan added the comment:
Agreed - I think the biggest thing we learned from the pre-implementation in
Python 3.7 is that the "Let's move as much config as we can to Python C API
data types" fell down in a couple of areas:
1. The embedding application is likely to
Change by Nick Coghlan :
--
stage: -> needs patch
type: -> enhancement
versions: +Python 3.8
___
Python tracker
<https://bugs.python.org/issue36124>
___
__
Nick Coghlan added the comment:
Oh, cool (both the fact the issue here is only with building cffi itself, and
that cffi creates extension modules that build with PY_LIMITED_API).
I've filed https://bugs.python.org/issue36124 to follow up on the
PyInterpreter_GetDict API idea
New submission from Nick Coghlan :
(New issue derived from https://bugs.python.org/issue35886#msg336501 )
cffi needs a generally available way to get access to a caching dict for the
currently active subinterpreter. Currently, they do that by storing it as an
attribute in the builtins
Nick Coghlan added the comment:
As a note in favour of the "Allow package nesting to be encoded in names, not
just directories" approach, we actually have a similar problem affecting
builtin modules: they're currently limited to top-level modules, with no way
for the module t
Nick Coghlan added the comment:
Yep, I completely understand (and agree with) the desire to eliminate the code
injection exploit that was introduced decades ago by using exec() to run lines
starting with "import " (i.e. "import sys; ").
I just don't want to lose th
Nick Coghlan added the comment:
(On closer inspection, that's actually be the same breakage as already
mentioned above)
However, what I'm not clear on is how this would affect projects that had
*already* generated their cffi code, and include that in their sdist. Are all
those sdists going
Nick Coghlan added the comment:
Next incompatibility: https://github.com/python-hyper/brotlipy/issues/147
(which indirectly broke httpbin)
--
___
Python tracker
<https://bugs.python.org/issue35
Nick Coghlan added the comment:
I think the only reason I didn't mention this discrepancy in my doc updates is
because I wasn't aware there *was* a discrepancy.
The weird syntax was then just an incorrect amalgamation of "optional argument"
notation with an improperly escaped re
Nick Coghlan added the comment:
The revised behaviour now makes the error messages consistent with each other:
>>> class TooManyArgs():
... def __new__(cls):
... super().__new__(cls, 1)
...
>>> TooManyArgs()
Traceback (most recent call last):
File &quo
Nick Coghlan added the comment:
New changeset 5105483acb3aca318304bed056dcfd7e188fe4b5 by Nick Coghlan (Sanyam
Khurana) in branch 'master':
bpo-31506: Clarify error messages for object.__new__ and object.__init__
(GH-11641)
https://github.com/python/cpython/commit
Nick Coghlan added the comment:
Paolo: it still won't be completely clear, since there's still the subtle issue
that __new__ is a static method rather than a class method, so the correct
calls up to the base class are respectively:
super(Singleton, cls).__new__(cls) # Static method, cls
Change by Nick Coghlan :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Nick Coghlan :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Nick Coghlan :
--
pull_requests: +11941
___
Python tracker
<https://bugs.python.org/issue35704>
___
___
Python-bugs-list mailing list
Unsubscribe:
Nick Coghlan added the comment:
Since I haven't really written them down anywhere else, noting some items I'm
aware of from the Python 3.7 internals work that haven't made their way back
into the PEP 432 public API proposal yet:
* If we only had to care about the pure embedding case
Nick Coghlan added the comment:
I agree the current text is ambiguous given how often folks refer to the
newline escape sequence as a "newline", but it isn't wrong - it's just talking
about escaping literal newlines in your source code like:
>>> "This is a
Nick Coghlan added the comment:
Folks use "python -m myproject.mymodule" to run code that they're working on
all the time - it's currently the only way to get sys.path right for cases like
that (otherwise you're exposed to the double import trap, where you can get two
copies of a
Nick Coghlan added the comment:
Having types created through the stable ABI potentially be deallocated when
their instances are deallocated is indeed a major problem, and fixing that
seems worth the risk of some types that were designed to handle that become
immortal.
--
nosy
Nick Coghlan added the comment:
Note also that Eric and I haven't failed to agree with Victor on an API, as
Victor hasn't actually written a concrete proposal *for* a public API (neither
as a PR updating PEP 432, nor as a separate PEP).
The current implementation does NOT follow the PEP
Nick Coghlan added the comment:
Steve, you're describing the goals of PEP 432 - design the desired API, then
write the code to implement it. So while Victor's goal was specifically to get
PEP 540 implemented, mine was just to make it so working on the startup
sequence was less awful
Nick Coghlan added the comment:
Cheryl has started the conversion process for the old user reference manuscript
[1], so I think it makes sense to mark this as "postponed" for now, until we
see how far we can get with this more usage-centric level of explanation as a
separate pr
Nick Coghlan added the comment:
As discussed in
http://python-notes.curiousefficiency.org/en/latest/python_concepts/import_traps.html#executing-the-main-module-twice
and https://www.python.org/dev/peps/pep-0395/#why-are-my-imports-broken the
cryptic error message here is due to the relative
Nick Coghlan added the comment:
Yeah, I mainly cc'ed Victor and Eric since making this easier ties into one of
the original design goals for PEP 432 (even though I haven't managed to
persuade either of them to become co-authors of that PEP yet
Nick Coghlan added the comment:
(Added Victor, Eric, and Steve to the nosy list here, as I'd actually forgotten
about this until issue #35706 reminded me)
Core of the problem: the embedding APIs don't currently offer a
Windows-compatible way of setting up "use this base Python and this
Nick Coghlan added the comment:
https://github.com/ncoghlan/python-userref/blob/master/ODF/Chapter01_EssentialConcepts.odt
is the Chapter 1 userref link now that the PSF SVN server has shut down.
Depending on what you mean by "Pursuing this...":
1. I'd definitely still l
Nick Coghlan added the comment:
Reviewing Rémi's page made me realise that a big part of the root cause here is
pickle support in exceptions predating the introduction of `__getnewargs__` and
`__getnewargs_ex__`.
--
nosy: +ncoghlan
___
Python
Change by Nick Coghlan :
--
pull_requests: -11260
___
Python tracker
<https://bugs.python.org/issue27015>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Nick Coghlan :
--
pull_requests: -11261
___
Python tracker
<https://bugs.python.org/issue27015>
___
___
Python-bugs-list mailing list
Unsubscribe:
Nick Coghlan added the comment:
+1 for Antoine's comment - while our approach with memoryview has generally
been "If you're doing serious work with n-dimensional data, you still need
NumPy (or an equivalent)", we've also been open to borrowing more NumPy
behaviours for
Nick Coghlan added the comment:
Added Dave Malcolm to the nosy list, as the more recent tracebacks are actually
throwing an exception in the gdb hooks, rather than just failing the expected
output comparison in the test suite.
--
nosy: +dmalcolm
Nick Coghlan added the comment:
A more recent discussion of this on python-dev:
https://mail.python.org/pipermail/python-dev/2019-January/156095.html
The situation there appears to be a case of "Hand off an OS level thread from
the creating interpreter to a different subinterpreter. A
Nick Coghlan added the comment:
#35839 is follow-up enhancement request, proposing that we tweak the
sys.modules handling in find_spec to ignore cache entries that don't have a
__spec__ attribute set.
--
___
Python tracker
<ht
Nick Coghlan added the comment:
I'd also suggest that we emit ImportWarning when taking the fallback path,
since we really would prefer that sys.modules entries either have a valid
__spec__, or else explicitly set `__spec__ = None`.
--
___
Python
Nick Coghlan added the comment:
OK, I've filed #35839 to propose falling back to a regular search when the
__spec__ attribute is missing, while treating "obj.__spec__ is None" as a true
negative cache entry.
--
___
Python track
New submission from Nick Coghlan :
(Alternate proposal inspired by the discussions in #35806 and #35791)
Currently, a sys.modules entry with no __spec__ attribute will prevent
importlib.util.find_spec() from locating the module, requiring the following
workaround:
def
Nick Coghlan added the comment:
Closing this without any changes contradicts the answer we gave Ronald on
#35791 that it's expected behaviour for importlib.find_spec() to throw an
exception for already loaded modules without a __spec__ attribute.
So if this stays closed, then we should
Nick Coghlan added the comment:
Yep, that's a bug in `py`'s module interface emulation - see the last paragraph
in https://docs.python.org/3/reference/import.html#module-spec
--
resolution: -> not a bug
stage: -> resolved
status: open -&g
Nick Coghlan added the comment:
Aye, we can :)
--
assignee: -> docs@python
components: +Documentation -Library (Lib)
nosy: +docs@python
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tra
Nick Coghlan added the comment:
Putting some of my comments here rather than on the PR, as they're design
questions related to "Is the current behaviour actually wrong?" and "Even if
the current behaviour is deemed technically incorrect, is it worth the risk of
changi
Nick Coghlan added the comment:
Note that any PEP I contributed to writing would need to be restricted to
eliminating arbitrary code execution, as I don't think there's anything wrong
with the path extension feature.
--
___
Python tracker
<ht
Nick Coghlan added the comment:
`site.addsitedir` is called for every site-packages directory (whether global,
within a venv, or at the user level), so my proposal above covers appending
multiple segments.
Linux distros approach to handling this is terrible because they dump all
Nick Coghlan added the comment:
Namespace packages in general didn't rely on pth files - only the
setuptools/pkg_resources implementation of them did.
I'll also reiterate that I am *completely* opposed to deprecating the "append
entries to sys.path" usage model, as there is
Nick Coghlan added the comment:
I'm suggesting PendingDeprecationWarning because we can't *actually* deprecate
anything until we provide a more transparent alternative that offers comparable
functionality, and I haven't seen a credible proposal for a replacement yet.
So using PDW would
Nick Coghlan added the comment:
Deriving __int__ from __float__ wouldn't be the right answer, as that can
easily lead to unwanted OverflowError exceptions and other issues.
However, Jeroen's suggested order of checking __index__ then __float__ then
__int__ in _PyTime_FromObject makes sense
Nick Coghlan added the comment:
@Rémi Aye, filling out derived slots is one of the things PyType_Ready does.
This would need a discussion on python-dev before going ahead and doing it
though, as the closest equivalent we have to this right now is the "negative"
derivation, where
Nick Coghlan added the comment:
dw: we routinely impose new requirements on folks modifying runtime internals
in new feature releases, so the only aspect we missed for this changing is to
explicitly call it out in the Porting section of the Python 3.6 What's New
document as a potential
Change by Nick Coghlan :
--
keywords: +patch, patch
pull_requests: +11147, 11148
stage: test needed -> patch review
___
Python tracker
<https://bugs.python.org/issu
Change by Nick Coghlan :
--
keywords: +patch, patch, patch
pull_requests: +11147, 11148, 11149
stage: test needed -> patch review
___
Python tracker
<https://bugs.python.org/issu
Change by Nick Coghlan :
--
keywords: +patch
pull_requests: +11147
stage: test needed -> patch review
___
Python tracker
<https://bugs.python.org/issu
Nick Coghlan added the comment:
To make a potentially viable concrete proposal here, I think a reasonable first
step would be to change the ".pth" file processing code in site.py to emit
PendingDeprecationWarning for the 'if line.startswith(("import ",
"import\t&
Change by Nick Coghlan :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Nick Coghlan added the comment:
New changeset b539cef31c060c7eecc331d25a23b80ded0baf08 by Nick Coghlan (Sanyam
Khurana) in branch 'master':
bpo-35614: Fix pydoc help() on metaclasses (#11357)
https://github.com/python/cpython/commit/b539cef31c060c7eecc331d25a23b80ded0baf08
Nick Coghlan added the comment:
Ah, you're right - I missed that the ForceASCII stuff was on the non-Windows
side of an ifdef so it's literally impossible for that change to affect
Windows, not just highly unlikely.
It would be interesting to compare the output of `python -vv` between
Nick Coghlan added the comment:
Reviewing the diff at https://github.com/python/cpython/compare/v3.7.1...v3.7.2
the only item I've spotted that seems like it could even plausibly be related
is the tweak at
https://github.com/python/cpython/compare/v3.7.1...v3.7.2#diff
Change by Nick Coghlan :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Nick Coghlan :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
301 - 400 of 8215 matches
Mail list logo