[issue42050] ensurepip fails if cwd contains illformed setup.cf

2021-01-30 Thread Jan Christoph


Jan Christoph  added the comment:

Just wanted to say, I ran into this while using direnv. See the issue I opened 
before knowing of this one: https://bugs.python.org/issue43038

--
nosy: +con-f-use
Added file: https://bugs.python.org/file49779/shell-session.txt

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



[issue43038] ensurepip: tries to use setup.py/setup.cfg

2021-01-27 Thread Jan Christoph


New submission from Jan Christoph :

Running

python3 -Im ensurepip --upgrade --default-pip

in a directory that contains a setup.cfg / setup.py combination, caused 
ensurepip to try and use these files, leading to

distutils.errors.DistutilsOptionError: error in setup.cfg: command 'build' has 
no such option 'icons'

A full shell session is attached that contains details on the exact files and 
python version involved involved.

I was under the impression ensurepip simply ensured that a suitable version of 
pip is installed with my Python distribution in use.

--
components: Library (Lib)
files: shell-session.txt
messages: 385767
nosy: con-f-use
priority: normal
severity: normal
status: open
title: ensurepip: tries to use setup.py/setup.cfg
type: behavior
versions: Python 3.8, Python 3.9
Added file: https://bugs.python.org/file49768/shell-session.txt

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



[issue27793] Double underscore variables in module are mangled when used in class

2020-03-06 Thread Jan Christoph


Jan Christoph  added the comment:

In particular, this might conflict with the documentation of global, which 
states:

> If the target is an identifier (name):
>
>If the name does not occur in a global statement in the current code 
> block: the name is bound to the object in the current local namespace.
>
>Otherwise: the name is bound to the object in the current global namespace.

There is no exception of names that are within the body of a class object and 
start (but not end) with double underscores.

--

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



[issue27793] Double underscore variables in module are mangled when used in class

2020-03-04 Thread Jan Christoph


Jan Christoph  added the comment:

Just because it is documented, doesn't mean it's not a bug or illogical and 
unexpected.

--

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



[issue27793] Double underscore variables in module are mangled when used in class

2020-03-04 Thread Jan Christoph


Jan Christoph  added the comment:

I would argue to reopen this. Seeing I and other people run into that issue 
(e.g. https://stackoverflow.com/q/40883083/789308) quiet frequently.

Especially since it breaks the `global` keyword, e.g.:

__superprivate = "mahog"

class AClass(object):
def __init__(self, value):
global __superprivate
__superprivate = value

@staticmethod
def get_sp():
return __superprivate

if __name__ == "__main__":
print(__superprivate)  # mahog
try:
print(AClass.get_sp()) 
except NameError as e:
print(e)   # NameError: name '_AClass__superprivate' is not 
defined'
cl = AClass("bla")
print(cl.get_sp()) # bla
__superprivate = 1
print(cl.get_sp()) # bla
print(AClass.get_sp()) # bla

--
nosy: +con-f-use

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



[issue34076] Nested loop in dictionary comprehension gives `global name not defined` inside class

2018-07-10 Thread Jan Christoph


Jan Christoph  added the comment:

Updated example with reversed variable order for reference. This really seems 
to be related to issue3692, but really not the same thing.

IMHO both `a` and `b` should be passed in a situation like this:


a = range(5)
b = range(3)
c = [x+y for x in a for y in b]


--
Added file: https://bugs.python.org/file47681/what_a_dict.py

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



[issue34076] Nested loop in dictionary comprehension gives `global name not defined` inside class

2018-07-10 Thread Jan Christoph


Jan Christoph  added the comment:

Okay, so we're a in another scope inside the dictionary comprehension (all 
comprehensions for that matter), and only one symbol is passed to the inside.

That's why `strange_reversed_working = {x+s.replace('(+/-)',''):None for x in 
infts.split(', ') for s in ('+','-','')}` functions, but if you reverse the 
order it does not. That's a real trap.

--

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



[issue34076] Nested loop in dictionary comprehension gives `global name not defined` inside class

2018-07-10 Thread Jan Christoph


Jan Christoph  added the comment:

But the simpler dictionary compprehension `{s.replace('(+/-)',''):None for s in 
infts.split(', ')}` works perfectly. Shouldn't that also give the error if it 
was a scope issue?

--

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



[issue34076] Nested loop in dictionary comprehension gives `global name not defined` inside class

2018-07-09 Thread Jan Christoph


New submission from Jan Christoph :

The python code: 
```
class _tri(object):
infts = '(+/-)inf, (+/-)infty, (+/-)infinity'

strange_failing = {x+s.replace('(+/-)',''):None for x in ('+','-','') for s 
in infts.split(', ')}
```

gives a `global name 'infts' is not defined` exception, when normal dictionary 
comprehensions (without nested loops) and regular nested for-loops work 
perfectly well.

For a complete shell session and more illustrative example in versions 2.7.15 
and 3.6.4 see: https://pastebin.ubuntu.com/p/9Pg8DThbsd/

--
components: Interpreter Core
files: what_a_dict.py
messages: 321326
nosy: con-f-use
priority: normal
severity: normal
status: open
title: Nested loop in dictionary comprehension gives `global name not defined` 
inside class
type: behavior
versions: Python 2.7
Added file: https://bugs.python.org/file47678/what_a_dict.py

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