[issue43113] os.posix_spawn errors with wrong information when shebang points to not-existing file

2021-02-10 Thread STINNER Victor


STINNER Victor  added the comment:

> Note that ENOENT is ambiguous, but the exception message is very specific 
> about what file is not found. And it is not always correct.

If you want to be extra nice, you can try to check if the file exists. If it 
exists, add a message about the shebang.

The problem is that the code to generate the exception is quite generic, it 
creates an OSError exception object from an errno (int) and a filename (str). 
It's not trivial to change the exception message. Is it worth it?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43001] python3.9.1 test_embed test_tabnanny failed

2021-02-10 Thread STINNER Victor


STINNER Victor  added the comment:

Try to run directly the two failing tests in verbose mode, copy/paste the 
output into a file and attach the file here:

python -m test test_embed test_tabnanny -v

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Mutable defaults

2021-02-10 Thread Chris Angelico
On Thu, Feb 11, 2021 at 6:03 PM Ross Wilson  wrote:
>
> On Thu, 11 Feb 2564 BE at 12:52 Grant Edwards 
> wrote:
>
> > On 2021-02-11, J. Pic  wrote:
> >
> > > I just meant removing the whole "default value mutating" story, not
> > > removing mutable variables. Really, I was wondering if there was a use
> > case
> > > where this actually turns to an advantage,
> >
> > I've seen people show how it can be used to provide function-scope
> > persistent storage -- the equivalent of declaring a static variable in
> > a C function. I don't think I've seen that done in the wild, though.
>
>
> Not sure this qualifies as "use in the wild", but the memoized naive
> Fibonacci is very nice when written this way:
>
> def fib(n, memo={0: 0, 1: 1}):
> if n not in memo:
> memo[n] = fib(n-1) + fib(n-2)
> return memo[n]

Yep, that's a pretty elegant example of mutable defaults as statics.
In theory, you could use this for a Fibonacci-like sequence, just by
passing an appropriate memo dictionary; to make that work, the
recursive calls would have to pass that down the line.

# What comes next in the sequence 1 3 4 7 11?
fib(6, {1:1, 2:3})

But otherwise, the memo parameter isn't really being used as a
parameter, it's just a way to maintain state. It could just as easily
be a global, a closure cell, or anything else.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Mutable defaults

2021-02-10 Thread Ross Wilson
On Thu, 11 Feb 2564 BE at 12:52 Grant Edwards 
wrote:

> On 2021-02-11, J. Pic  wrote:
>
> > I just meant removing the whole "default value mutating" story, not
> > removing mutable variables. Really, I was wondering if there was a use
> case
> > where this actually turns to an advantage,
>
> I've seen people show how it can be used to provide function-scope
> persistent storage -- the equivalent of declaring a static variable in
> a C function. I don't think I've seen that done in the wild, though.


Not sure this qualifies as "use in the wild", but the memoized naive
Fibonacci is very nice when written this way:

def fib(n, memo={0: 0, 1: 1}):
if n not in memo:
memo[n] = fib(n-1) + fib(n-2)
return memo[n]
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43198] Operations on sets more than hundred times less efficient with python3.9 than with previous versions

2021-02-10 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

This only affects the contrived case of adding and removing exactly the same 
element in a tight loop, when the set is large.  Optimizing that one corner 
case came at the expense of all other cases.  The code is now simpler and 
slightly faster than before.  This is also what we do for dictionaries.

$ python3.8 -m timeit -r 11 -s 's=set(range(10_000))' 'for i in range(10_000): 
(s.discard(i), s.add(10_000 - i))'
200 loops, best of 11: 1.72 msec per loop

$ python3.9 -m timeit -r 11 -s 's=set(range(10_000))' 'for i in range(10_000): 
(s.discard(i), s.add(10_000 - i))'
200 loops, best of 11: 1.09 msec per loop

Thank you for the report, but this was an intended change.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Mutable defaults

2021-02-10 Thread Grant Edwards
On 2021-02-11, J. Pic  wrote:

> I just meant removing the whole "default value mutating" story, not
> removing mutable variables. Really, I was wondering if there was a use case
> where this actually turns to an advantage,

I've seen people show how it can be used to provide function-scope
persistent storage -- the equivalent of declaring a static variable in
a C function. I don't think I've seen that done in the wild, though.

class StaticStorage():
pass

def foo(static=StaticStorage()):
if not hasattr(static,'x'):
static.x = 0
static.x += 1
return static.x

print(foo())
print(foo())
print(foo())
print(foo())
print(foo())

Run that, and it prints:

1
2
3
4
5



-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why am I unable to using rsync to install modules and appear to have to use pip install instead?

2021-02-10 Thread Robert Nicholson
Ok this was due to an install of miniconda then choosing to unconditionally 
install an older version of cryptography.

> On Feb 10, 2021, at 3:40 PM, Robert Nicholson  
> wrote:
> 
> Just reinstalling cryptography with pip install seems to have fixed my issue.
> 
> Any pointers on why?
> 
>> On Feb 10, 2021, at 3:21 PM, Robert Nicholson  
>> wrote:
>> 
>> I’m using Python 3.7.0
>> 
>> so I have multiple environments all on the same architecture with the same 
>> python release using anonconda.
>> 
>> What I discovered was that if I install the cryptography module in my dev / 
>> uat and then tried to synchronize to production server using rsync I ended 
>> up with errors relating to dependencies of the cryptography module. 
>> 
>> Specifically 
>> 
>> Cannot import name ‘_get_backend’
>> 
>> these errors appear to have gone away if I actually use pip install 
>> cryptography==3.2.1  instead of using rsync from an existing install machine.
>> 
>> why is this the case?
>> 
>> 
>> 
> 

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why am I unable to using rsync to install modules and appear to have to use pip install instead?

2021-02-10 Thread Robert Nicholson
Just reinstalling cryptography with pip install seems to have fixed my issue.

Any pointers on why?

> On Feb 10, 2021, at 3:21 PM, Robert Nicholson  
> wrote:
> 
> I’m using Python 3.7.0
> 
> so I have multiple environments all on the same architecture with the same 
> python release using anonconda.
> 
> What I discovered was that if I install the cryptography module in my dev / 
> uat and then tried to synchronize to production server using rsync I ended up 
> with errors relating to dependencies of the cryptography module. 
> 
> Specifically 
> 
> Cannot import name ‘_get_backend’
> 
> these errors appear to have gone away if I actually use pip install 
> cryptography==3.2.1  instead of using rsync from an existing install machine.
> 
> why is this the case?
> 
> 
> 

-- 
https://mail.python.org/mailman/listinfo/python-list


Why am I unable to using rsync to install modules and appear to have to use pip install instead?

2021-02-10 Thread Robert Nicholson
I’m using Python 3.7.0

so I have multiple environments all on the same architecture with the same 
python release using anonconda.

What I discovered was that if I install the cryptography module in my dev / uat 
and then tried to synchronize to production server using rsync I ended up with 
errors relating to dependencies of the cryptography module. 

Specifically 

Cannot import name ‘_get_backend’

these errors appear to have gone away if I actually use pip install 
cryptography==3.2.1  instead of using rsync from an existing install machine.

why is this the case?



-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python subinterpreters with separate GILs

2021-02-10 Thread Christian Heimes
On 11/02/2021 03.51, James Lu wrote:
> Directly removing the Global Interpreter Lock (GIL) would break a lot
> of libraries that implicitly assume it is there. What if Python had
> "realms" that each had separate GILs?
> 
> The "realms" (not sure if "subinterpreter" is the correct term here)
> could share objects.

Eric Snow and others have been working on that since 2017,
https://www.python.org/dev/peps/pep-0554/

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python subinterpreters with separate GILs

2021-02-10 Thread Cameron Simpson
On 10Feb2021 21:51, James Lu  wrote:
>Directly removing the Global Interpreter Lock (GIL) would break a lot
>of libraries that implicitly assume it is there. What if Python had
>"realms" that each had separate GILs?
>
>The "realms" (not sure if "subinterpreter" is the correct term here)
>could share objects.

If realms can shared objects then they'd need the same GIL, because 
otherwise objects are not protected from concurrency via different 
realms. CPython code and C code, unless it has itself released the GIL, 
assumes it is the exclusive user of objects - that's what the GIL means.  
Separate GILs would mean different realms' GIL-holding threads could run 
against a shared object at the same time.

Cheers,
Cameron Simpson 
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43195] Same userbase for 32bit and 64bit install on Windows causing conflicts

2021-02-10 Thread Eryk Sun


Eryk Sun  added the comment:

The conflict between 32-bit and 64-bit user site-packages was resolved in issue 
41627, starting with Python 3.10. It's not practical to backport this change to 
existing 3.9 installations. 

The "nt_user" install scheme was changed to use the config variable 
"py_version_nodot_plat". For example:

>>> sysconfig.get_path('purelib', 'nt_user', expand=False)
'{userbase}/Python{py_version_nodot_plat}/site-packages'

This variable is based on sys.winver (i.e. the version number of the Python 
DLL), which includes a "-32" suffix in 32-bit Python. For example:

>>> sys.winver
'3.10-32'
>>> sysconfig.get_config_var('py_version_nodot_plat')
'310-32'

--
nosy: +eryksun
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Relocate user site packages on Windows 32-bit

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43198] Operations on sets more than hundred times less efficient with python3.9 than with previous versions

2021-02-10 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

I bisected the change to here:

https://github.com/python/cpython/pull/19881
commit 3dd2157febae5087cad24f69b6de9cbd13cd
Author: Raymond Hettinger 
Date:   Sun May 3 04:51:05 2020 -0700

Simplify set entry insertion logic. (GH-19881)

"""Dictionaries no longer reuse dummy entries. Instead, dummies accumulate 
until cleared by resizes. That is a good strategy because it tightens the inner 
search loop and it makes the code cleaner. Here, we do the same thing for 
sets"""


It looks like this was a deliberate change to speed up lookups, but it also 
looks like it adversely affected this case.  With dictionaries, mutation 
typically occurs as setting a different value for the same key---no dummy 
entries get created, so dummy entries are less common. But with sets, mutation 
can only come from adding/discarding, so maybe this optimization is less 
worthwhile for sets.

--
nosy: +Dennis Sweeney

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Mutable defaults

2021-02-10 Thread J. Pic
Ok, maybe:

def foo(x=:[], y=:len(x)):

As a shorthand for:

@default(x=lambda: [], y=lambda x: len(x))
def foo(x=None, y=None):

=: Is the contraction for =lambda:

At the same time, this new syntax avoid breaking def foo(x=lamba: []) which
is completely different as we know.

Le jeu. 11 févr. 2021 à 04:03, Chris Angelico  a écrit :

> On Thu, Feb 11, 2021 at 1:55 PM J. Pic  wrote:
> >
> > Adding decorators with some inspect sauce could certainly work with the
> syntax we already have:
> >
> > @default(x=lambda: copy([]), y=lambda x: len(x))
> > def foo(x=None, y=None):
>
> This would work, although the copy is unnecessary here. But you're
> assuming that it magically figures out whether to pass 'x' or not.
> Seems awkward. Also, it doesn't solve the problems of signature
> display, so you're not really much better than:
>
> def foo(x=None, y=None):
> if x is None: x = []
> if y is None: y = len(x)
>
> > I think this PoC is doable. But the lambda copy is a boring so, two
> decorators:
> >
> > @default.copy(x=[])
> > @default.call(y=lamba x: len(x))
> > def foo(x=None, y=None):
> >
> > Or with a new syntax:
> >
> > def foo(x:=[], y`=len(x))
>
> Now this is the sort of thing I was talking about: actual syntactic
> support. But this syntax looks pretty terrible, and if you propose it
> like this, I doubt it'll be accepted. Backtick had a very very
> different meaning in Py2, and := is going to be extremely confusing.
>
> This proposal will stand or fall on the syntax. Don't just give
> placeholder syntax. Put some thought into figuring out what would
> actually be good, and propose *that*. The semantics aren't really even
> that hard - it'd be equivalent to an if statement just inside the
> function.
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Mutable defaults

2021-02-10 Thread Chris Angelico
On Thu, Feb 11, 2021 at 1:55 PM J. Pic  wrote:
>
> Adding decorators with some inspect sauce could certainly work with the 
> syntax we already have:
>
> @default(x=lambda: copy([]), y=lambda x: len(x))
> def foo(x=None, y=None):

This would work, although the copy is unnecessary here. But you're
assuming that it magically figures out whether to pass 'x' or not.
Seems awkward. Also, it doesn't solve the problems of signature
display, so you're not really much better than:

def foo(x=None, y=None):
if x is None: x = []
if y is None: y = len(x)

> I think this PoC is doable. But the lambda copy is a boring so, two 
> decorators:
>
> @default.copy(x=[])
> @default.call(y=lamba x: len(x))
> def foo(x=None, y=None):
>
> Or with a new syntax:
>
> def foo(x:=[], y`=len(x))

Now this is the sort of thing I was talking about: actual syntactic
support. But this syntax looks pretty terrible, and if you propose it
like this, I doubt it'll be accepted. Backtick had a very very
different meaning in Py2, and := is going to be extremely confusing.

This proposal will stand or fall on the syntax. Don't just give
placeholder syntax. Put some thought into figuring out what would
actually be good, and propose *that*. The semantics aren't really even
that hard - it'd be equivalent to an if statement just inside the
function.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Mutable defaults

2021-02-10 Thread J. Pic
Silly me, we don't even need copy but just execution

@lazy(x=lambda: [], y=lamba x: len(x))
def foo(x=None, y=None):

So only one operator is needed, the walrus is still fine:

def foo(x:=[], y:=len(x)):

Not copy, just evaluate.

Le jeu. 11 févr. 2021 à 03:54, J. Pic  a écrit :

> Adding decorators with some inspect sauce could certainly work with the
> syntax we already have:
>
> @default(x=lambda: copy([]), y=lambda x: len(x))
> def foo(x=None, y=None):
>
> I think this PoC is doable. But the lambda copy is a boring so, two
> decorators:
>
> @default.copy(x=[])
> @default.call(y=lamba x: len(x))
> def foo(x=None, y=None):
>
> Or with a new syntax:
>
> def foo(x:=[], y`=len(x))
>
> Here walrus is used to denote that an assignment of the right side is
> going to take place at call, and the backtick to denote that execution of
> the right side is going to take place.
>
> Le jeu. 11 févr. 2021 à 03:06, Chris Angelico  a écrit :
>
>> On Thu, Feb 11, 2021 at 12:56 PM J. Pic  wrote:
>> >
>> > I just meant removing the whole "default value mutating" story, not
>> removing mutable variables. Really, I was wondering if there was a use case
>> where this actually turns to an advantage, in which case it would be a
>> designed feature rather than an undesirable side effect, which it seems to
>> be.
>> >
>>
>> Right, I know you weren't asking about removing mutables altogether.
>> But how would you remove "default value mutating"? Do you disallow any
>> mutable values from being argument defaults? Because that's a huge
>> category of values that are no longer available.
>>
>> Mutable defaults most certainly ARE used deliberately, although often
>> it's more as a sort of "static variable" rather than actually a
>> parameter. But it's common enough as an idiom that it can't be changed
>> without breaking a lot of code.
>>
>> > Now I'm wondering if you have considered copy on write, to save the
>> overhead from copying every mutable default at every call when it is not
>> necessary.
>> >
>>
>> That's its own level of mess.
>>
>> The only way to move forward with this is something
>> backward-compatible, which probably means an explicit request for late
>> binding (or copying, which comes to much the same thing). But it needs
>> an elegant syntax. The proposal lives or dies on that syntax, and so
>> far, it's always died.
>>
>> ChrisA
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Mutable defaults

2021-02-10 Thread J. Pic
Adding decorators with some inspect sauce could certainly work with the
syntax we already have:

@default(x=lambda: copy([]), y=lambda x: len(x))
def foo(x=None, y=None):

I think this PoC is doable. But the lambda copy is a boring so, two
decorators:

@default.copy(x=[])
@default.call(y=lamba x: len(x))
def foo(x=None, y=None):

Or with a new syntax:

def foo(x:=[], y`=len(x))

Here walrus is used to denote that an assignment of the right side is going
to take place at call, and the backtick to denote that execution of the
right side is going to take place.

Le jeu. 11 févr. 2021 à 03:06, Chris Angelico  a écrit :

> On Thu, Feb 11, 2021 at 12:56 PM J. Pic  wrote:
> >
> > I just meant removing the whole "default value mutating" story, not
> removing mutable variables. Really, I was wondering if there was a use case
> where this actually turns to an advantage, in which case it would be a
> designed feature rather than an undesirable side effect, which it seems to
> be.
> >
>
> Right, I know you weren't asking about removing mutables altogether.
> But how would you remove "default value mutating"? Do you disallow any
> mutable values from being argument defaults? Because that's a huge
> category of values that are no longer available.
>
> Mutable defaults most certainly ARE used deliberately, although often
> it's more as a sort of "static variable" rather than actually a
> parameter. But it's common enough as an idiom that it can't be changed
> without breaking a lot of code.
>
> > Now I'm wondering if you have considered copy on write, to save the
> overhead from copying every mutable default at every call when it is not
> necessary.
> >
>
> That's its own level of mess.
>
> The only way to move forward with this is something
> backward-compatible, which probably means an explicit request for late
> binding (or copying, which comes to much the same thing). But it needs
> an elegant syntax. The proposal lives or dies on that syntax, and so
> far, it's always died.
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Python subinterpreters with separate GILs

2021-02-10 Thread James Lu
Directly removing the Global Interpreter Lock (GIL) would break a lot
of libraries that implicitly assume it is there. What if Python had
"realms" that each had separate GILs?

The "realms" (not sure if "subinterpreter" is the correct term here)
could share objects.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Mutable defaults

2021-02-10 Thread Chris Angelico
On Thu, Feb 11, 2021 at 12:56 PM J. Pic  wrote:
>
> I just meant removing the whole "default value mutating" story, not removing 
> mutable variables. Really, I was wondering if there was a use case where this 
> actually turns to an advantage, in which case it would be a designed feature 
> rather than an undesirable side effect, which it seems to be.
>

Right, I know you weren't asking about removing mutables altogether.
But how would you remove "default value mutating"? Do you disallow any
mutable values from being argument defaults? Because that's a huge
category of values that are no longer available.

Mutable defaults most certainly ARE used deliberately, although often
it's more as a sort of "static variable" rather than actually a
parameter. But it's common enough as an idiom that it can't be changed
without breaking a lot of code.

> Now I'm wondering if you have considered copy on write, to save the overhead 
> from copying every mutable default at every call when it is not necessary.
>

That's its own level of mess.

The only way to move forward with this is something
backward-compatible, which probably means an explicit request for late
binding (or copying, which comes to much the same thing). But it needs
an elegant syntax. The proposal lives or dies on that syntax, and so
far, it's always died.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Mutable defaults

2021-02-10 Thread J. Pic
I just meant removing the whole "default value mutating" story, not
removing mutable variables. Really, I was wondering if there was a use case
where this actually turns to an advantage, in which case it would be a
designed feature rather than an undesirable side effect, which it seems to
be.

Now I'm wondering if you have considered copy on write, to save the
overhead from copying every mutable default at every call when it is not
necessary.

Le jeu. 11 févr. 2021 à 02:46, Paul Bryan  a écrit :

> Also -1 on changing the existing default behavior. +1 to an opt-in
> late-bound solution.
>
> On Thu, 2021-02-11 at 10:29 +1100, Chris Angelico wrote:
> > On Thu, Feb 11, 2021 at 10:17 AM J. Pic  wrote:
> > >
> > > > Most of us know of the perils of mutable default values.
> > >
> > > And those who don't pay the price.
> > >
> > > I wonder what would be the harm in removing them
> >
> > Define "removing". Most objects in Python are mutable; would that
> > mean
> > you can no longer use any custom class, or any object at all that has
> > a __dict__, as a default?
> >
> > > or doing copy on call by default.
> >
> > I assume you are referring only to argument defaults, because
> > copy-on-call for ALL parameters would be ridiculously costly, not to
> > mention problematic in many ways.
> >
> > The main problem is that mutable defaults are only very rarely an
> > issue (for starters, you have to actually mutate the object - just
> > because it's mutable, that doesn't mean you'll change anything), but
> > any global "solution" to the "problem" is going to have a very high
> > global cost. Not every mutable object is copyable. And it would have
> > to be a deep copy (in case, for instance, the default is a tuple
> > containing a list), which has even more cost.
> >
> > Strongly -1 on any proposal to change the defaults.
> >
> > Now, if you're interested in some kind of proposal for opt-in
> > late-bound defaults, I think there'd be some value in researching
> > that. It would probably require language support, but there'd be a
> > few
> > potential advantages:
> >
> > 1) The function signature would actually say the real default. For
> > instance, "def flurble(stuff=[]):" shows that the default is a list,
> > but "def flurble(stuff=None): if stuff is None: stuff = []" doesn't.
> > 2) This could be more flexible than just copying. The default could
> > simply be an expression that's evaluated at call time, and could even
> > refer to other arguments (eg "def frob(things, start=0,
> > stop=len(things)):"), and, again, the displayed signature would show
> > the real default, instead of some placeholder.
> > 3) It's far cleaner to read a coherent function signature than to
> > have
> > to read a handful of lines at the top of the function. That's why we
> > have defaults in the first place.
> >
> > But this would depend heavily on finding a really good syntax for it.
> > It's been investigated at times, but no proposal has ever been strong
> > enough to push forward. Feel free to try a few things out, see if you
> > can find something that makes sense.
> >
> > ChrisA
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Mutable defaults

2021-02-10 Thread Paul Bryan
Also -1 on changing the existing default behavior. +1 to an opt-in
late-bound solution.

On Thu, 2021-02-11 at 10:29 +1100, Chris Angelico wrote:
> On Thu, Feb 11, 2021 at 10:17 AM J. Pic  wrote:
> > 
> > > Most of us know of the perils of mutable default values.
> > 
> > And those who don't pay the price.
> > 
> > I wonder what would be the harm in removing them
> 
> Define "removing". Most objects in Python are mutable; would that
> mean
> you can no longer use any custom class, or any object at all that has
> a __dict__, as a default?
> 
> > or doing copy on call by default.
> 
> I assume you are referring only to argument defaults, because
> copy-on-call for ALL parameters would be ridiculously costly, not to
> mention problematic in many ways.
> 
> The main problem is that mutable defaults are only very rarely an
> issue (for starters, you have to actually mutate the object - just
> because it's mutable, that doesn't mean you'll change anything), but
> any global "solution" to the "problem" is going to have a very high
> global cost. Not every mutable object is copyable. And it would have
> to be a deep copy (in case, for instance, the default is a tuple
> containing a list), which has even more cost.
> 
> Strongly -1 on any proposal to change the defaults.
> 
> Now, if you're interested in some kind of proposal for opt-in
> late-bound defaults, I think there'd be some value in researching
> that. It would probably require language support, but there'd be a
> few
> potential advantages:
> 
> 1) The function signature would actually say the real default. For
> instance, "def flurble(stuff=[]):" shows that the default is a list,
> but "def flurble(stuff=None): if stuff is None: stuff = []" doesn't.
> 2) This could be more flexible than just copying. The default could
> simply be an expression that's evaluated at call time, and could even
> refer to other arguments (eg "def frob(things, start=0,
> stop=len(things)):"), and, again, the displayed signature would show
> the real default, instead of some placeholder.
> 3) It's far cleaner to read a coherent function signature than to
> have
> to read a handful of lines at the top of the function. That's why we
> have defaults in the first place.
> 
> But this would depend heavily on finding a really good syntax for it.
> It's been investigated at times, but no proposal has ever been strong
> enough to push forward. Feel free to try a few things out, see if you
> can find something that makes sense.
> 
> ChrisA

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43198] Operations on sets more than hundred times less efficient with python3.9 than with previous versions

2021-02-10 Thread Zachary Ware


Zachary Ware  added the comment:

Can reproduce on Linux:

$ for python in /usr/bin/python3.? /usr/local/bin/python3.?
do 
$python -VV
$python -m timeit -r 10 -n 100_000 -u usec -s 'S = set(range(10_000))' 
'S.remove(5000);S.add(5000)'
done
Python 3.8.5 (default, Jul 28 2020, 12:59:40) 
[GCC 9.3.0]
10 loops, best of 10: 0.0831 usec per loop
Python 3.6.11 (tags/v3.6.11:d56cd4006a, Jul  1 2020, 10:47:06) 
[GCC 9.3.0]
10 loops, best of 10: 0.0968 usec per loop
Python 3.7.9 (tags/v3.7.9:13c94747c7, Oct 19 2020, 23:50:03) 
[GCC 9.3.0]
10 loops, best of 10: 0.0935 usec per loop
Python 3.9.0 (tags/v3.9.0:9cf6752276, Nov 14 2020, 15:41:20) 
[GCC 9.3.0]
10 loops, best of 10: 50.2 usec per loop

--
nosy: +rhettinger, zach.ware

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43198] Operations on sets more than hundred times less efficient with python3.9 than with previous versions

2021-02-10 Thread Eric Martin


New submission from Eric Martin :

Run on a MacBook Pro (15-inch, 2019)
 2.3 GHz 8-Core Intel Core i9
 16 GB 2400 MHz DDR4


Python 3.8.7 (default, Dec 24 2020, 19:07:18) 
[Clang 12.0.0 (clang-1200.0.32.27)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from timeit import timeit
>>> S = set(range(10_000))
>>> timeit('S.remove(5000); S.add(5000)', globals=globals(), number=100_000)
0.0193329169984

$ python3.9
Python 3.9.1 (default, Dec  8 2020, 13:10:53) 
[Clang 12.0.0 (clang-1200.0.32.27)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from timeit import timeit
>>> S = set(range(10_000))
>>> timeit('S.remove(5000); S.add(5000)', globals=globals(), number=100_000)
3.851722548998

--
components: Interpreter Core
messages: 386815
nosy: eamartin
priority: normal
severity: normal
status: open
title: Operations on sets more than hundred times less efficient with python3.9 
than with previous versions
type: performance
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Mutable defaults

2021-02-10 Thread Chris Angelico
On Thu, Feb 11, 2021 at 10:17 AM J. Pic  wrote:
>
> > Most of us know of the perils of mutable default values.
>
> And those who don't pay the price.
>
> I wonder what would be the harm in removing them

Define "removing". Most objects in Python are mutable; would that mean
you can no longer use any custom class, or any object at all that has
a __dict__, as a default?

> or doing copy on call by default.

I assume you are referring only to argument defaults, because
copy-on-call for ALL parameters would be ridiculously costly, not to
mention problematic in many ways.

The main problem is that mutable defaults are only very rarely an
issue (for starters, you have to actually mutate the object - just
because it's mutable, that doesn't mean you'll change anything), but
any global "solution" to the "problem" is going to have a very high
global cost. Not every mutable object is copyable. And it would have
to be a deep copy (in case, for instance, the default is a tuple
containing a list), which has even more cost.

Strongly -1 on any proposal to change the defaults.

Now, if you're interested in some kind of proposal for opt-in
late-bound defaults, I think there'd be some value in researching
that. It would probably require language support, but there'd be a few
potential advantages:

1) The function signature would actually say the real default. For
instance, "def flurble(stuff=[]):" shows that the default is a list,
but "def flurble(stuff=None): if stuff is None: stuff = []" doesn't.
2) This could be more flexible than just copying. The default could
simply be an expression that's evaluated at call time, and could even
refer to other arguments (eg "def frob(things, start=0,
stop=len(things)):"), and, again, the displayed signature would show
the real default, instead of some placeholder.
3) It's far cleaner to read a coherent function signature than to have
to read a handful of lines at the top of the function. That's why we
have defaults in the first place.

But this would depend heavily on finding a really good syntax for it.
It's been investigated at times, but no proposal has ever been strong
enough to push forward. Feel free to try a few things out, see if you
can find something that makes sense.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Mutable defaults

2021-02-10 Thread J. Pic
> Most of us know of the perils of mutable default values.

And those who don't pay the price.

I wonder what would be the harm in removing them, or doing copy on call by
default.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue40956] Use Argument Clinic in sqlite3

2021-02-10 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset ea46579067fd2d4e164d6605719ffec690c4d621 by Erlend Egeberg 
Aasland in branch 'master':
bpo-40956: Fix segfault when Connection.backup is called without target 
(GH-24503)
https://github.com/python/cpython/commit/ea46579067fd2d4e164d6605719ffec690c4d621


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43094] sqlite3 signature discrepancies between documentation and implementation

2021-02-10 Thread Berker Peksag


Berker Peksag  added the comment:

The problem is that sqlite3 isn't the only module where there are discrepancies 
between documentation and implementation. If we are going to change public 
sqlite3 APIs in to be positional-only, I'd prefer writing a PEP and fix all 
modules once and for all.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43188] multiple operations of dict causes core dump of Python interpreter.

2021-02-10 Thread Inada Naoki


Inada Naoki  added the comment:

Is this the crash you are reporting?

```
Exception ignored in: .Mutating.__del__ at 0x100d35af0>
Traceback (most recent call last):
  File "/Users/methane/work/python/cpython/PC/xxx.py", line 5, in __del__
mutate(d)
TypeError: 'str' object is not callable
Exception ignored in: .Mutating.__del__ at 0x100d35c10>
Traceback (most recent call last):
  File "/Users/methane/work/python/cpython/PC/xxx.py", line 5, in __del__
Fatal Python error: _Py_CheckRecursiveCall: Cannot recover from stack overflow.
Python runtime state: initialized

Current thread 0x00010072bd40 (most recent call first):
  File "/Users/methane/work/python/cpython/xxx.py", line 9 in 
check_reentrant_insertion
  File "/Users/methane/work/python/cpython/xxx.py", line 13 in 
test_reentrant_insertion
  File "/Users/methane/work/python/cpython/xxx.py", line 18 in 
test_reentrant_insertion
...
```

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43188] multiple operations of dict causes core dump of Python interpreter.

2021-02-10 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I can confirm this crashes.

--
nosy: +methane, rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43178] Redundant method overrides in queue

2021-02-10 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I prefer to keep the code as-is.  It is microscopically faster than than just 
inheriting the methods, but more importantly it makes it easier to read the 
code and know that it is correct.  We're instructing people to override all 
four methods when subclassing and we don't make any promises about how the 
parent method is implemented.  At this point, the implementations happen to be 
the same, but that isn't guaranteed.  We could at some point change the 
implementation of the parent class method and wouldn't want the subclasses to 
break.

So, let's keep the loose coupling, the self-contained code that follows the 
rules, code that is slightly faster, and code that is easy to read.

Thank you for the suggestion, but this micro-factoring doesn't make us better 
off.

--
nosy: +rhettinger
resolution:  -> rejected
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43197] random.shuffle() returning None

2021-02-10 Thread Pablo


Pablo  added the comment:

random shuffle is supposed to change the list in place.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43197] random.shuffle() returning None

2021-02-10 Thread Pablo


Pablo  added the comment:

```
import random
mylist = ["apple", "banana", "cherry"]
print(random.shuffle(mylist))
```

Result: None
Expected result: A shuffled list

It works in Python 3.7.3 but it fails in Python 3.8.5 (Ubuntu 20.04.2)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43197] random.shuffle() returning None

2021-02-10 Thread Pablo


New submission from Pablo :

import random
mylist = ["apple", "banana", "cherry"]
print(random.shuffle(mylist))

Result: None
Expected result: A shuffle list

It works in Python 3.7.3 but it fails in Python 3.8.5 (Ubuntu 20.04.2)

--
messages: 386807
nosy: pablonana
priority: normal
severity: normal
status: open
title: random.shuffle() returning None
type: behavior
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43094] sqlite3 signature discrepancies between documentation and implementation

2021-02-10 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

sqlite3.Connection.set_progress_handler()

docs: set_progress_handler(handler, n)
impl: set_progress_handler(progress_handler, n)


Apart from that, the rest of sqlite3.Connection seems to be ok.

There's an ongoing discussion at python-dev about how to resolve this issue. 
I'm in favour of normalising the create_*() methods to be positional only (like 
create_collation() is now).

sqlite3.Cursor and sqlite3.Row methods seems to be ok as well.

--
title: Update sqlite3 docs and docstrings to reflect implementation -> sqlite3 
signature discrepancies between documentation and implementation

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40956] Use Argument Clinic in sqlite3

2021-02-10 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
pull_requests: +23293
pull_request: https://github.com/python/cpython/pull/24503

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43196] logging.config.dictConfig shuts down socket for existing SysLogHandlers

2021-02-10 Thread Ellis Percival


New submission from Ellis Percival :

Since 
https://github.com/python/cpython/commit/b6c1989168efeb8b6320bec958e7e339270ac0ce
 dictConfig (and presumably fileConfig) has called logging.shutdown() on the 
existing handlers.

This causes existing SysLogHandlers' sockets to be closed, which then causes a 
BadFileDescriptor error when you try to use it:

--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.8/logging/handlers.py", line 940, in emit
self.socket.sendto(msg, self.address)
OSError: [Errno 9] Bad file descriptor
Call stack:
  File "/home/flyte/workspaces/python/test.py", line 18, in 
log.warning("Breaks")

Reproduce the error with the following code:

import logging.config
import socket
from logging.handlers import SysLogHandler

log = logging.getLogger("logtest")
syslog_handler = SysLogHandler(("127.0.0.1", 12345), socktype=socket.SOCK_DGRAM)
log.addHandler(syslog_handler)

log.warning("Works")

logging.config.dictConfig(
{
"version": 1,
"disable_existing_loggers": False,
}
)

log.warning("Breaks")

This causes issues such as https://github.com/benoitc/gunicorn/issues/2073 
where gunicorn sets up a SysLogHandler, then when any app (Django does it by 
default) calls dictConfig() it closes the socket used by gunicorn's 
SysLogHandler.

Assuming this also affects Python 3.9 and 3.10, but untested.

--
components: Library (Lib)
messages: 386805
nosy: flyte
priority: normal
severity: normal
status: open
title: logging.config.dictConfig shuts down socket for existing SysLogHandlers
type: crash
versions: Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43195] Same userbase for 32bit and 64bit install on Windows causing conflicts

2021-02-10 Thread Christoph Reiter


New submission from Christoph Reiter :

I'm sure this is already filed somewhere, but I couldn't find anything.

Currently when installing packages with pip using a 64bit Python to --user and 
then starting a 32bit Python things fail because they look up packages from the 
same location:

.\python.exe -m site --user-base
C:\Users\user\AppData\Roaming\Python

For example trying to import numpy from a 32bit Python when it was installed 
with 64bit:

>>> import numpy
Traceback (most recent call last):
  File "", line 1, in 
  File 
"C:\Users\user\AppData\Roaming\Python\Python39\site-packages\numpy\__init__.py",
 line 143, in 
from . import _distributor_init
  File 
"C:\Users\user\AppData\Roaming\Python\Python39\site-packages\numpy\_distributor_init.py",
 line 26, in 
WinDLL(os.path.abspath(filename))
  File "C:\Python39-32\lib\ctypes\__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application

I guess this isn't a very common problem, but in MSYS2 we are facing this issue 
because users can easily switch between 32bit/64bit Python. We could patch 
things, but I'm wondering if there are any plans to fix this in CPython itself 
so we don't invent our own thing.

thanks

--
components: Windows
messages: 386804
nosy: lazka, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Same userbase for 32bit and 64bit install on Windows causing conflicts
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: installation issues

2021-02-10 Thread Ming
On Tue, Feb 09, 2021 at 03:23:56PM -0800, Martin Lopez wrote:
> Hello,
> 
> My name is Martin Lopez. I just downloaded Python 3.9.1 (64 bit) Setup.
> 
> After I install the program then try to run it, with no success.
> 
> I've uninstalled all previous versions and reinstalled them, but it does
> not seem to help.
> 
> Can you please assist?
> 
> Thank you,

How did you run it? Are there any error messages?
If there is not enough information, no one can help you solve the
issues.

Personal guess:
Did you not add python.exe to the Path environment variable? (You can
check this option during the installation process to let the installer
add it for you, or you can add it manually after the installation is
complete)

-- 
OpenPGP fingerprint: 3C47 5977 4819 267E DD64  C7E4 6332 5675 A739 C74E


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Running Jupyter Notebook

2021-02-10 Thread Terry Reedy

On 2/10/2021 9:26 AM, Rafael Llera wrote:

I installed Python and jupyter via pip, but when I run jupyter notebook I
keep getting the following error.

  Requirement already satisfied: pyparsing>=2.0.2 in
c:\users\mitzi\appdata\roaming\python\python39\site-packages (from
packaging->bleach->nbconvert->jupyter) (2.4.7)
Requirement already satisfied: qtpy in
c:\users\mitzi\appdata\roaming\python\python39\site-packages (from
qtconsole->jupyter) (1.9.0)

C:\WINDOWS\system32>jupyter notebook
'jupyter' is not recognized as an internal or external command,
operable program or batch file.


When you install some software, it is a good idea to read at least a 
basic introduction as to how to use it, especially when your naive 
efforts fail.


https://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/index.html

PS: Running commands in the system32 directory or anything in C:\Windows 
is a bad idea since you might accidentally change something so something 
no longer works properly.



--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


[issue43191] Shared Memory for array of object

2021-02-10 Thread Eric V. Smith


Eric V. Smith  added the comment:

If you could demonstrate the problem without numpy, then we could probably help 
you here. I don't know much about numpy.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43192] Argparse complains argument required when default is provided

2021-02-10 Thread Clint Olsen


Clint Olsen  added the comment:

I think your original suggestion makes sense: '?'

My intuition is that nargs helps argparse discern whether it's dealing with 
single or multiple values. That may not be what was intended.

There probably shouldn't be multiple ways of indicating an argument is 
optional. It seems that required= and nargs='?'|'*' combinations could lead to 
conflicting requirements.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43192] Argparse complains argument required when default is provided

2021-02-10 Thread Eric V. Smith

Eric V. Smith  added the comment:

Would you infer it to be ‘?’ or ‘*’?

I’m not completely opposed, but I haven’t thought it through or looked at the 
code.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43155] PyCMethod_New not defined in python3.lib

2021-02-10 Thread Barry Alan Scott


Barry Alan Scott  added the comment:

Is there a test suite that checks that the limited API functions can all be 
linked against?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43192] Argparse complains argument required when default is provided

2021-02-10 Thread Clint Olsen


Clint Olsen  added the comment:

Do you think it's unreasonable/unintuitive to infer nargs from the default 
value?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43113] os.posix_spawn errors with wrong information when shebang points to not-existing file

2021-02-10 Thread Alexey Izbyshev


Alexey Izbyshev  added the comment:

I generally agree, but getting a good, short error message seems to be the hard 
part here. I previously complained[1] about the following proposal by @hroncok:

FileNotFoundError: [Errno 2] No such file or directory: Either './demo' or the 
interpreter of './demo' not found.

But may be it's just me. Does anybody else feel that mentioning "the 
interpreter" is this way could be confusing in prevalent cases when the actual 
problem is missing './demo' itself? If we can come up with a good message, I 
can look into turning it into a PR.

The error message above also reads to me like there are no other possible 
reasons of ENOENT. On Linux, binfmt_misc[2] provides a way to run arbitrary 
code on execve(). This is used, for example, to transparently run binaries for 
foreign arches via qemu-user, so probably ENOENT would be returned if QEMU 
itself it missing. QEMU *may* be thought as a kind of interpreter here, though 
it's completely unrelated to a hash-bang or an ELF interpreter.

But I don't know about other POSIX platforms. As a theoretical example, if the 
dynamic library loader is implemented in the kernel, the system call could 
return ENOENT in case of a missing library. Do we need to worry about it? Does 
anybody know about the situation on macOS, where posix_spawn() is a system call 
too?

[1] https://bugs.python.org/issue43113#msg386210
[2] https://en.wikipedia.org/wiki/Binfmt_misc

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43112] SOABI on Linux does not distinguish between GNU libc and musl libc

2021-02-10 Thread Natanael Copa


Natanael Copa  added the comment:

I created a PR for this https://github.com/python/cpython/pull/24502

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43112] SOABI on Linux does not distinguish between GNU libc and musl libc

2021-02-10 Thread Natanael Copa


Change by Natanael Copa :


--
keywords: +patch
pull_requests: +23292
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24502

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Running Jupyter Notebook

2021-02-10 Thread tommy yama
Hi,

Have you tried this?

python -m notebook



On Wed, Feb 10, 2021 at 11:28 PM Rafael Llera  wrote:

> I installed Python and jupyter via pip, but when I run jupyter notebook I
> keep getting the following error.
>
>  Requirement already satisfied: pyparsing>=2.0.2 in
> c:\users\mitzi\appdata\roaming\python\python39\site-packages (from
> packaging->bleach->nbconvert->jupyter) (2.4.7)
> Requirement already satisfied: qtpy in
> c:\users\mitzi\appdata\roaming\python\python39\site-packages (from
> qtconsole->jupyter) (1.9.0)
>
> C:\WINDOWS\system32>jupyter notebook
> 'jupyter' is not recognized as an internal or external command,
> operable program or batch file.
>
> C:\WINDOWS\system32>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43146] 3.10a5 regression: AttributeError: 'NoneType' object has no attribute '__suppress_context__' in traceback.py

2021-02-10 Thread Irit Katriel


Irit Katriel  added the comment:

Marking as blocker because these are 3.10 regressions.

--
priority: normal -> release blocker

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29249] Pathlib glob ** bug

2021-02-10 Thread Julien Palard


Julien Palard  added the comment:

I'm +1 on adding ** to match.

My first bet would be to add it to match, not adding a new method, nor a flag, 
as it should not break compatibility:

It would only break iif someone have a `**` in a match AND does *not* expect it 
to be recursive (as it would continue to match the previous files, it may just 
match more).

Would this break something I did not foresee?

--
nosy: +mdk

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42744] pkg_resources seems to treat python 3.10 as python 3.1

2021-02-10 Thread RhinosF1


RhinosF1  added the comment:

Thanks. Very likely!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43113] os.posix_spawn errors with wrong information when shebang points to not-existing file

2021-02-10 Thread Eric V. Smith


Eric V. Smith  added the comment:

I agree with @hroncok, and maybe we could tweak the message to say

FileNotFoundError: [Errno 2] No such file or directory: while executing 
'./demo'. Maybe bad shebang, or missing file?

Or something to that effect. I realize that listing all possible error reasons 
is a fool's errand, and there are cases where it might make things more 
confusing.

This reminds me of the old MS-DOS errors like "A duplicate file name exists, or 
the file cannot be found": as a user, I always wanted to scream "you know which 
one, tell me!". Sadly, you can't always get the OS to give you the info. Which 
is also like Windows "can't load DLL" errors: which one?!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42744] pkg_resources seems to treat python 3.10 as python 3.1

2021-02-10 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

setuptools and pip were upgraded in alpha 5 which could have fixed this : 
https://github.com/python/cpython/commit/4d11ecbb5ed78e6259ee27289c7638aad795f473

--
nosy: +xtreak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43113] os.posix_spawn errors with wrong information when shebang points to not-existing file

2021-02-10 Thread Miro Hrončok

Miro Hrončok  added the comment:

Note that ENOENT is ambiguous, but the exception message is very specific about 
what file is not found. And it is not always correct.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42744] pkg_resources seems to treat python 3.10 as python 3.1

2021-02-10 Thread RhinosF1


Change by RhinosF1 :


--
type: compile error -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42744] pkg_resources seems to treat python 3.10 as python 3.1

2021-02-10 Thread RhinosF1


RhinosF1  added the comment:

Can't seem to reproduce on alpha 5.

https://github.com/MirahezeBots/MirahezeBots/pull/431/checks?check_run_id=1873007567

https://github.com/python/cpython/compare/v3.10.0a3...v3.10.0a5 doesn't load 
for me so not sure when it was fixed.

--
resolution:  -> fixed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42744] pkg_resources seems to treat python 3.10 as python 3.1

2021-02-10 Thread RhinosF1


RhinosF1  added the comment:

Adding log before it gets cleaned up as too old.

2020-12-25T17:42:03.0730305Z Traceback (most recent call last):
2020-12-25T17:42:03.0733282Z   File 
"/opt/hostedtoolcache/Python/3.10.0-alpha.3/x64/lib/python3.10/site-packages/pkg_resources/__init__.py",
 line 584, in _build_master
2020-12-25T17:42:03.0736279Z ws.require(__requires__)
2020-12-25T17:42:03.0737901Z   File 
"/opt/hostedtoolcache/Python/3.10.0-alpha.3/x64/lib/python3.10/site-packages/pkg_resources/__init__.py",
 line 901, in require
2020-12-25T17:42:03.0739330Z needed = 
self.resolve(parse_requirements(requirements))
2020-12-25T17:42:03.0742242Z   File 
"/opt/hostedtoolcache/Python/3.10.0-alpha.3/x64/lib/python3.10/site-packages/pkg_resources/__init__.py",
 line 792, in resolve
2020-12-25T17:42:03.0744366Z raise VersionConflict(dist, 
req).with_context(dependent_req)
2020-12-25T17:42:03.0747963Z pkg_resources.ContextualVersionConflict: (geoip2 
4.1.0 
(/opt/hostedtoolcache/Python/3.10.0-alpha.3/x64/lib/python3.10/site-packages), 
Requirement.parse('geoip2<3.0'), {'sopel'})
2020-12-25T17:42:03.0754140Z 
2020-12-25T17:42:03.0754883Z During handling of the above exception, another 
exception occurred:
2020-12-25T17:42:03.0755487Z 
2020-12-25T17:42:03.0756004Z Traceback (most recent call last):
2020-12-25T17:42:03.0757250Z   File 
"/opt/hostedtoolcache/Python/3.10.0-alpha.3/x64/bin/sopel", line 6, in 
2020-12-25T17:42:03.0758216Z from pkg_resources import load_entry_point
2020-12-25T17:42:03.0759775Z   File 
"/opt/hostedtoolcache/Python/3.10.0-alpha.3/x64/lib/python3.10/site-packages/pkg_resources/__init__.py",
 line 3262, in 
2020-12-25T17:42:03.0760984Z def _initialize_master_working_set():
2020-12-25T17:42:03.0762804Z   File 
"/opt/hostedtoolcache/Python/3.10.0-alpha.3/x64/lib/python3.10/site-packages/pkg_resources/__init__.py",
 line 3245, in _call_aside
2020-12-25T17:42:03.0763832Z f(*args, **kwargs)
2020-12-25T17:42:03.0765396Z   File 
"/opt/hostedtoolcache/Python/3.10.0-alpha.3/x64/lib/python3.10/site-packages/pkg_resources/__init__.py",
 line 3274, in _initialize_master_working_set
2020-12-25T17:42:03.078Z working_set = WorkingSet._build_master()
2020-12-25T17:42:03.0768222Z   File 
"/opt/hostedtoolcache/Python/3.10.0-alpha.3/x64/lib/python3.10/site-packages/pkg_resources/__init__.py",
 line 586, in _build_master
2020-12-25T17:42:03.0769460Z return 
cls._build_from_requirements(__requires__)
2020-12-25T17:42:03.0771154Z   File 
"/opt/hostedtoolcache/Python/3.10.0-alpha.3/x64/lib/python3.10/site-packages/pkg_resources/__init__.py",
 line 599, in _build_from_requirements
2020-12-25T17:42:03.0772389Z dists = ws.resolve(reqs, Environment())
2020-12-25T17:42:03.0773911Z   File 
"/opt/hostedtoolcache/Python/3.10.0-alpha.3/x64/lib/python3.10/site-packages/pkg_resources/__init__.py",
 line 787, in resolve
2020-12-25T17:42:03.0775227Z raise DistributionNotFound(req, requirers)
2020-12-25T17:42:03.0776843Z pkg_resources.DistributionNotFound: The 
'geoip2<3.0' distribution was not found and is required by sopel
2020-12-25T17:42:03.0924206Z ##[error]Process completed with exit code 1.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Very starnge problem in python

2021-02-10 Thread David Lowry-Duda
Hello!

> The very strange thing which is happening here is you see variable 
> arr2 at ID id_ttt before changing the variable tt at the same ID (i.e. 
> id_ttt]) is showing some value but once I am printing its value after 
> assigning tt[id_ttt] = 0.0, arr2[id_ttt] is also showing 0 value 
> however, I have not touched arr2 anywhere as far as changing its 
> values are concerned.

The relevant lines are these:

> def get_match(arr1, arr2, tol, itr):
> tt = arr2

In python, this assignment doesn't make a copy, it makes `tt` and `arr2` 
refer to the same list.

You can examine this with this little code.

```
arr = [1, 2, 3]
arr_other = arr
arr_other[1] = "different"
print(arr_other) # This line prints the same
print(arr)   # array as this line.
```

Thus when you assign `tt = arr2`, modifying `tt` will modify `arr2`, and 
vice-versa.

Cheers - DLD

-- 
David Lowry-Duda  
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue42967] [security] urllib.parse.parse_qsl(): Web cache poisoning - `; ` as a query args separator

2021-02-10 Thread Senthil Kumaran


Senthil Kumaran  added the comment:

I meant, "I did some research, but couldn't come away conclusively".

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42967] [security] urllib.parse.parse_qsl(): Web cache poisoning - `; ` as a query args separator

2021-02-10 Thread Senthil Kumaran


Senthil Kumaran  added the comment:

Sorry for that, Ned. I will take a decision on this by Saturday (13-Feb).

I did some research, but could come way conclusively. I have not heard any 
opinions (+ves or -ves) on this.  This will be a breaking change, so necessary 
to support it with documentation, alerts etc.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Very starnge problem in python

2021-02-10 Thread Priya Singh
def closset_match(check, arr, itr):
id_min = []
for ii in range(itr):
id_min_tmp = np.argmin( abs(arr - check) )
id_min.append(id_min_tmp)
arr[id_min_tmp] = float('-inf')
id_min = np.array(id_min)
return id_min

def get_match(arr1, arr2, tol, itr):
tt = arr2
for ii in range(5,6):
id_com = np.where( abs(arr1[ii] - tt) < tol )[0]
if np.size(id_com) >= itr:
mm = closset_match(arr1[ii], tt[id_com], itr)
id_ttt  = np.array(id_com)[mm]
#print(id_ttt)
print(arr2[id_ttt])
tt[id_ttt] = 0.0 -.9 ###float('-inf')
print(arr2[id_ttt])   

This is the two routines I am using to compare the two float arrays and getting 
the matching in them up to some tolerance.

The very strange thing which is happening here is you see variable arr2 at ID 
id_ttt before changing the variable tt at the same ID (i.e. id_ttt]) is showing 
some value but once I am printing its value after assigning tt[id_ttt] = 0.0, 
arr2[id_ttt] is also showing 0 value however, I have not touched arr2 anywhere 
as far as changing its values are concerned.

Can any one please help me.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43113] os.posix_spawn errors with wrong information when shebang points to not-existing file

2021-02-10 Thread Alexey Izbyshev


Alexey Izbyshev  added the comment:

How do you propose to approach documentation of such behavior? The underlying 
cause is the ambiguity of ENOENT error code from execve() returned by the 
kernel, so it applies to all places where Python can call execve(), including 
os.posixspawn(), os.execve() and subprocess, so it's not clear to me where such 
documentation should be placed. And, of course, this behavior is not specific 
to CPython.

The Linux man pages mention various causes of this error[1], though POSIX 
doesn't[2].

While ENOENT ambiguity is indeed confusing, one of the top results of my DDG 
search on "linux no such file or directory but script exists" is this link[3].

[1] https://man7.org/linux/man-pages/man2/execve.2.html
[2] https://pubs.opengroup.org/onlinepubs/9699919799/functions/execve.html
[3] 
https://stackoverflow.com/questions/3949161/no-such-file-or-directory-but-it-exists

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42967] [security] urllib.parse.parse_qsl(): Web cache poisoning - `; ` as a query args separator

2021-02-10 Thread Ned Deily


Ned Deily  added the comment:

Ping. This issue has been delaying 3.7.x and 3.6.x security releases. I would 
prefer to have it resolved before releasing.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43190] < test.support > check_free_after_iterating( ) causes core dump in handling iteration.

2021-02-10 Thread Irit Katriel


Irit Katriel  added the comment:

This looks similar to 43185.

--
nosy: +iritkatriel

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43191] Shared Memory for array of object

2021-02-10 Thread Hannah Busshoff


Hannah Busshoff  added the comment:

Hi Eric,

Thanks for your quick reply. The numpy operation was only an attempt to 
serialize the nested list and make it available as a shared memory object.  As 
is written in the documentation, the SharedList() does not take nested lists as 
an input. 

I posed the question as well on Stackoverflow with a slightly longer example. 
Feel free to check it out: 
https://stackoverflow.com/questions/66138235/multiprocessing-with-array-of-objects-in-shared-memory.
 

Thanks again. 

Cheers, 

Hannah

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43194] Add JFXX as jpeg marker in imghdr module

2021-02-10 Thread JiKwon Kim


New submission from JiKwon Kim :

Currently imghdr module only finds "JFIF" or "Exif" in specific position. 
However there's some jpeg images with "JFXX" marker. I had some image with this 
marker and imghdr.what() returned None.

Refer to:
https://www.ecma-international.org/wp-content/uploads/ECMA_TR-98_1st_edition_june_2009.pdf
(Section 10.1 JFIF Extension APP0 Marker Segment)

--
components: Library (Lib)
messages: 386782
nosy: elbarkwon
priority: normal
pull_requests: 23291
severity: normal
status: open
title: Add JFXX as jpeg marker in imghdr module
type: enhancement
versions: Python 3.10, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43192] Argparse complains argument required when default is provided

2021-02-10 Thread Eric V. Smith


Eric V. Smith  added the comment:

Providing a default value does not imply setting nargs, so you need to specify 
both. I think it's not clear what nargs would default to, if you wanted to 
change the behavior if default= is supplied.. In your example you probably want 
nargs='?', not '*'.

--
nosy: +eric.smith

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Running Jupyter Notebook

2021-02-10 Thread Rafael Llera
I installed Python and jupyter via pip, but when I run jupyter notebook I
keep getting the following error.

 Requirement already satisfied: pyparsing>=2.0.2 in
c:\users\mitzi\appdata\roaming\python\python39\site-packages (from
packaging->bleach->nbconvert->jupyter) (2.4.7)
Requirement already satisfied: qtpy in
c:\users\mitzi\appdata\roaming\python\python39\site-packages (from
qtconsole->jupyter) (1.9.0)

C:\WINDOWS\system32>jupyter notebook
'jupyter' is not recognized as an internal or external command,
operable program or batch file.

C:\WINDOWS\system32>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: installation issues

2021-02-10 Thread Mats Wichmann

On 2/9/21 4:23 PM, Martin Lopez wrote:

Hello,

My name is Martin Lopez. I just downloaded Python 3.9.1 (64 bit) Setup.

After I install the program then try to run it, with no success.

I've uninstalled all previous versions and reinstalled them, but it does
not seem to help.

Can you please assist?


This is going to sound rude, but is not intended that way:

No, we can't help because you've given no information.

Seemingly, you've had previous versions of Python working (it's not 
necessary to uninstall them to add a new one).  What is different?  What 
is the symptom of "no success".





--
https://mail.python.org/mailman/listinfo/python-list


[issue43185] AssertRaises() causes core dump in handling recursion

2021-02-10 Thread Mark Shannon


Change by Mark Shannon :


--
assignee:  -> Mark.Shannon
components: +Interpreter Core -Library (Lib)
versions:  -Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43191] Shared Memory for array of object

2021-02-10 Thread Eric V. Smith


Eric V. Smith  added the comment:

This looks like a numpy usage question, not a python bug. I suggest you ask on 
Stackoverflow or a numpy user forum.

--
nosy: +eric.smith

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42500] crash with unbounded recursion in except statement

2021-02-10 Thread Mark Shannon


Change by Mark Shannon :


--
pull_requests: +23290
pull_request: https://github.com/python/cpython/pull/24501

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43185] AssertRaises() causes core dump in handling recursion

2021-02-10 Thread Mark Shannon


Mark Shannon  added the comment:

I think this was fixed by https://github.com/python/cpython/pull/23568

The root cause seems to be the same as #42500, so I'm going to backport 
https://github.com/python/cpython/pull/23568 to 3.9

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43185] AssertRaises() causes core dump in handling recursion

2021-02-10 Thread Irit Katriel


Irit Katriel  added the comment:

Yang - no secret really, just trial and error.
Mark - right I wasn't on master, sorry.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Best practices for software architecture in Python

2021-02-10 Thread Henning Follmann
On 2021-02-10, Python  wrote:
> Hi,
>
>   If you had to train engineers who are used to write
> Python scripts for image processing, data format conversion,
> etc. (so they know most the basics of Python types and
> programming structures except advanced OOP techniques)
> who now are about to develop quite a big application
> in the same field (to get rid of some well known proprietary
> scientific software monoliths), and would like to study in-depth
> an existing open source application in order to study how
> to organize classes hierarchy, modules, packages, etc. which
> one would you recommend ?
>
> P.

Looks like you (the project leader?) needs training, not the 
software engineers.

"Making Things Happen" by Scott Berkun

-H



-- 
Henning Follmann   | hfollm...@itcfollmann.com

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43185] AssertRaises() causes core dump in handling recursion

2021-02-10 Thread Mark Shannon


Mark Shannon  added the comment:

3.9 crashes.
On master, I'm not seeing a crash, just a RecursionError.


>>> import unittest
>>> 
>>> def f():
... raise TypeError
... 
>>> class TestAudioop(unittest.TestCase):
... def test_invalid_adpcm_state(self):
... self.assertRaises(TypeError, f) 
... self.test_invalid_adpcm_state()
... 
>>> TestAudioop().test_invalid_adpcm_state()
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 4, in test_invalid_adpcm_state
  File "", line 4, in test_invalid_adpcm_state
  File "", line 4, in test_invalid_adpcm_state
  [Previous line repeated 992 more times]
  File "", line 3, in test_invalid_adpcm_state
  File "/home/mark/repos/cpython/Lib/unittest/case.py", line 730, in 
assertRaises
context = _AssertRaisesContext(expected_exception, self)
  File "/home/mark/repos/cpython/Lib/unittest/case.py", line 168, in __init__
_BaseTestCaseContext.__init__(self, test_case)
RecursionError: maximum recursion depth exceeded

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Fwd: Inconveniente

2021-02-10 Thread MRAB

On 2021-02-09 22:34, Terry Reedy wrote:

On 2/9/2021 3:39 PM, dn via Python-list wrote:

On 09/02/2021 15.13, Juan Jose Reyna Figuera wrote:



[ Translation:
matplotlib (and seaborn) not playing-nicely with Python 3.9 64-bit
edition on MS-Win 10. Solved by down-grading to Python 3.8 32-bit.
]


Yes, there have been problems with certain libraries that have not (yet)
been updated to run on Python 3.9. Your solution is the current advice.


I checked that seaborn lists 3.9.  To my surprise, matplotlib does not.
   If real, not good, and indeed, using 3.8 is the only solution.  A
traceback from matplotlib failing might have revealed the specific problem.


Christoph Gohlke's site appears to have it:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib
--
https://mail.python.org/mailman/listinfo/python-list


[issue43185] AssertRaises() causes core dump in handling recursion

2021-02-10 Thread Yang Feng


Yang Feng  added the comment:

Could you please tell me your secret method of getting the minimal script?
I will try to provide minimal ones in our following work.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43185] AssertRaises() causes core dump in handling recursion

2021-02-10 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43185] AssertRaises() causes core dump in handling recursion

2021-02-10 Thread Irit Katriel


Irit Katriel  added the comment:

Reproduced on master as well. Simplified script:

--
import unittest

def f():
raise TypeError

class TestAudioop(unittest.TestCase):
def test_invalid_adpcm_state(self):
self.assertRaises(TypeError, f) 
self.test_invalid_adpcm_state()

TestAudioop().test_invalid_adpcm_state()

--

--
nosy: +Mark.Shannon, iritkatriel

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Troubles with Python imports

2021-02-10 Thread Roland Mueller via Python-list
ke 10. helmik. 2021 klo 5.07 Terry Reedy (tjre...@udel.edu) kirjoitti:

> On 2/9/2021 9:55 AM, Philipp Daher via Python-list wrote:
> > Hello,
> >
> > I’ve just typed „pip install selenium“ into my command prompt on windows
> 10. Although my computer told me that the requirement was already
> satisfied, import selenium did not work. So I tried different methods to
> install it and typed „Python“ in my command prompt and imported selenium.
> It worked fine. Then, I typed it into my shell and got an error. Why is it
> working in the command prompt but not in the actual shell?
>
> One common problem (and answer -- monthy on stackoverflow) is that you
> have more than one python binary installed; do not have module xyz
> installed for all of them; and are running different binaries to get the
> different responses.
>
>
> May be the first thing is to check whether one is using the right pip.
Example output is from Linux box, but in Windows the output should also
show the relevant information:
$ pip -V
pip 19.3.1 from /usr/lib/python3.8/site-packages/pip (python 3.8)
$ python -V
Python 3.8.7


>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3.9. 1 not working

2021-02-10 Thread Roland Mueller via Python-list
Hello,

Please note that this is not a kind of support service rather than a
community where people help each other on voluntary base.

In order to get help from here, you should provide enough information about
your issue with Python 3.9 that others can figure out what happened.

BR,
Roland

ke 10. helmik. 2021 klo 5.10 Martin Lopez (mmllopezmar...@gmail.com)
kirjoitti:

> Where do I inquire about installation support?
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43145] Leak of locks from multiprocessing.Process

2021-02-10 Thread Boris Staletic


Boris Staletic  added the comment:

The `multiprocessing.Process`, on Linux, ends up doing something like this:

pid = os.fork()
if pid == 0: os._exit()

Translated to C:

int main() {
Py_Initialize();
PyOS_BeforeFork();
pid_t pid = fork();
if (pid == 0) {
PyOS_AfterFork_Child(); // Reinitializes stuff.
_exit(0); // Child process exits without cleanup.
}
PyOS_AfterFork_Parent();
Py_Finalize();
}

The call to `_exit()` happens in Lib/multiprocessing/popen_fork.py#L73

My attempts at cleaning this up resulted in even more problems.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43155] PyCMethod_New not defined in python3.lib

2021-02-10 Thread Zackery Spytz


Change by Zackery Spytz :


--
keywords: +patch
nosy: +ZackerySpytz
nosy_count: 1.0 -> 2.0
pull_requests: +23289
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24500

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43112] SOABI on Linux does not distinguish between GNU libc and musl libc

2021-02-10 Thread h-vetinari


Change by h-vetinari :


--
nosy: +h-vetinari

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43113] os.posix_spawn errors with wrong information when shebang points to not-existing file

2021-02-10 Thread Tomas Orsava


Tomas Orsava  added the comment:

I agree that at least documenting the behaviour is a good idea. This bug has 
seriously confused our QE person with years of experience, and then me when 
debugging with him. Chances are it's going to confuse somebody else too.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43193] Installer for All users

2021-02-10 Thread Muhammad Hussein Ammari


New submission from Muhammad Hussein Ammari :

I installed Python for All users
Installer make below file to %LocalAppData% (Instead of %ProgramData%)
"%LocalAppData%\Package Cache\{b2be55ad-3177-42aa-a6c2-53004684e4ea}"
Now other user can't unistalling Python.
Please fix this issue.

--
components: Windows
messages: 386772
nosy: paul.moore, steve.dower, tim.golden, xmha97, zach.ware
priority: normal
severity: normal
status: open
title: Installer for All users
type: enhancement
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43192] Argparse complains argument required when default is provided

2021-02-10 Thread Clint Olsen


Clint Olsen  added the comment:

Sorry, I meant to say args.foo should be 'bar'.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43192] Argparse complains argument required when default is provided

2021-02-10 Thread Clint Olsen


New submission from Clint Olsen :

When I run the following program, I expect args.run to be 'foo' if no argument 
is specified on the command-line.

parser = argparse.ArgumentParser()

parser.add_argument('foo', default='bar')

args = parser.parse_args()

$ ./test
usage: test [-h] foo
test: error: the following arguments are required: foo

However if I specify nargs='*' this error goes away.

Maybe I'm missing something obvious, but this seems non-intuitive to me.

--
components: Library (Lib)
messages: 386770
nosy: Clint Olsen
priority: normal
severity: normal
status: open
title: Argparse complains argument required when default is provided
type: behavior
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43183] Asyncio can't close sockets properly on Linux cause CLOSE_WAIT

2021-02-10 Thread Bob


Change by Bob :


--
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43191] Shared Memory for array of object

2021-02-10 Thread Hannah Busshoff


New submission from Hannah Busshoff :

Dear all, 

When seeking to put an object of type -- Array of object -- into shared memory 
when doing multiprocessing via starmap, I am encountering problems -- in that 
sense that the program does not finish running but apparently gets stuck. 

I attached a minimal example. 

Many thanks for your help. I sincerely hope I have not overlooked that this 
issue has been raised by somebody else. I am happy to provide further input!

Cheers, 

Hannah

--
files: example.py
messages: 386769
nosy: hannahbusshoff
priority: normal
severity: normal
status: open
title: Shared Memory for array of object
type: crash
versions: Python 3.8
Added file: https://bugs.python.org/file49801/example.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43190] < test.support > check_free_after_iterating( ) causes core dump in handling iteration.

2021-02-10 Thread Yang Feng


New submission from Yang Feng :

In the following program, we call check_free_after_iterating( ) twice, in the 
second time, we recursively call function test_free_after_iterating(). Python 
interpreter crashes.
+++
import unittest
import test.support

class UnicodeTest(unittest.TestCase):
pass

def test_free_after_iterating():
ut = UnicodeTest()
test.support.check_free_after_iterating(ut, iter, str)
test.support.check_free_after_iterating(str, test_free_after_iterating(), 
str)

test_free_after_iterating()
+

System Info: Ubuntu 16.04
Python Version:  Python 3.9.1

--
components: Library (Lib)
messages: 386768
nosy: CharlesFengY
priority: normal
severity: normal
status: open
title: < test.support > check_free_after_iterating( ) causes core dump in 
handling iteration.
type: crash
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43189] decorator function run_with_locale() crashes Python interpreter

2021-02-10 Thread Yang Feng


New submission from Yang Feng :

We use run_with_locale() as decorator function, then we recursively call 
test_float__format__locale in the following example. Python interpreter crashes.
+++
from test.support import run_with_locale

@run_with_locale('LC_NUMERIC', 'en_US.UTF8')
def test_float__format__locale():
test_float__format__locale()
test_float__format__locale()
+

System Info: Ubuntu 16.04
Python Version:  Python 3.9.1

--
components: Tests
messages: 386767
nosy: CharlesFengY
priority: normal
severity: normal
status: open
title:  decorator function run_with_locale() crashes Python 
interpreter
type: crash
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43188] multiple operations of dict causes core dump of Python interpreter.

2021-02-10 Thread Yang Feng


New submission from Yang Feng :

In the following programs, we call check_reentrant_insertion("s") twice,  after 
multiple of update and clear of dict, the Python interpreter crashes.
+++
def check_reentrant_insertion(mutate):

class Mutating:
def __del__(self):
mutate(d)

d = {k: Mutating() for k in 'abcdefghijklmnopqr'}
for k in list(d):
d[k] = k

def test_reentrant_insertion():

check_reentrant_insertion("s")

def mutate(d):
d.update(DictTest.__dict__)
d.clear()
check_reentrant_insertion(test_reentrant_insertion())

test_reentrant_insertion()
+

System Info: Ubuntu 16.04
Python Version:  Python 3.9.1

--
components: Interpreter Core
messages: 386766
nosy: CharlesFengY
priority: normal
severity: normal
status: open
title:  multiple operations of dict causes core dump of Python 
interpreter.
type: crash
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43187] Dict creation in recursive function cause interpreter crashes.

2021-02-10 Thread Yang Feng


New submission from Yang Feng :

In the following programs, dict is created in recursive calls. Then a core dump 
is reported by Python interpreter.
+++
def test_equal_operator_modifying_operand():

class X():

def __del__(DictTest):
dict_b.clear()

def __eq__(DictTest, other):
dict_a.clear()
return True

def __hash__(DictTest):
return 13
dict_d = {X(): 0}

class Y():

def __eq__(DictTest, other):
dict_d.clear()
return True
dict_d = {0: Y()}
# dict_c = {0: set()}
test_equal_operator_modifying_operand()

test_equal_operator_modifying_operand()
+

--
components: Interpreter Core
messages: 386765
nosy: CharlesFengY
priority: normal
severity: normal
status: open
title: Dict creation in recursive function cause interpreter crashes.
type: crash
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43186] Recursive call causes core dump in assertRaises

2021-02-10 Thread Yang Feng


New submission from Yang Feng :

In following teststr.py, class MyString is nestedly instanced in method 
__getattr__(). This script will lead to a  "core dump" in Python interpreter.  
My Python version is  3.9.1 and my operating system is Ubuntu 16.04. 

teststr.py
+++
class StrError(str):
pass

class MyString:

def __init__(self, istr):
self.__mystr__ = istr

def __getattr__(self, content):
with self:
return MyString(getattr(self.__mystr__, content))

def __setattr__(self, content, sstr):
setattr(self.__mystr__, content)

def __enter__(self):
return self

def __exit__(self, exc_type, exc_val, exc_tb):
 raise StrError(self.__mystr__) 
 return True

MyString("hello")
+

--
components: Library (Lib)
messages: 386764
nosy: CharlesFengY
priority: normal
severity: normal
status: open
title: Recursive call causes core dump in assertRaises
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43145] Leak of locks from multiprocessing.Process

2021-02-10 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
title: Leak of locks in a subprocess -> Leak of locks from 
multiprocessing.Process

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43185] AssertRaises() causes core dump in handling recursion

2021-02-10 Thread Yang Feng


New submission from Yang Feng :

Seeing the following program, in the second assertRaises(), function 
"test_invalid_adpcm_state()"  is recursively called. Then a fatal Python error 
shows up and the Python interpreter crashes. 

++
import unittest
import audioop

class TestAudioop(unittest.TestCase):
 pass

def test_invalid_adpcm_state():
 TestAudioop.assertRaises(TypeError, audioop.lin2adpcm, b'\x00', 1, 555)
 TestAudioop.assertRaises(test_invalid_adpcm_state(), 
audioop.adpcm2lin, b'\x00', 1, (0, (- 1)))

TestAudioop = TestAudioop()
test_invalid_adpcm_state()

+++

System Info: Ubuntu 16.04
Python Version:  Python 3.9.1

--
components: Library (Lib)
messages: 386763
nosy: CharlesFengY
priority: normal
severity: normal
status: open
title:  AssertRaises() causes core dump in handling recursion
type: crash
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43184] Missing docs for LoggerAdapter manager and name property

2021-02-10 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +vinay.sajip

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43184] Missing docs for LoggerAdapter manager and name property

2021-02-10 Thread Yoav Palti


New submission from Yoav Palti :

I found the following issue which added manager and name properties to 
logging.LoggerAdapter on version 3.6:
https://bugs.python.org/issue31457
However the current docs don't have them documented:
https://docs.python.org/3.6/library/logging.html#logging.LoggerAdapter

--
assignee: docs@python
components: Documentation
messages: 386762
nosy: docs@python, yoavp10
priority: normal
severity: normal
status: open
title: Missing docs for LoggerAdapter manager and name property
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >