[issue32806] locally imported modules are unaccessible in lambdas in pdb

2018-02-09 Thread Yuri Kanivetsky

New submission from Yuri Kanivetsky <yuri.kanivet...@gmail.com>:

Consider the following script:

# import pdb; pdb.set_trace()
# import re
def f():
import re
print((lambda: re.findall('a', 'aaa'))())
import pdb; pdb.set_trace()
print('test')
f()

When you run it and try to evaluate `(lambda: re.findall('a', 'aaa'))()`, you 
get:

['a', 'a', 'a']
> /home/yuri/_/1.py(7)f()
-> print('test')
(Pdb) (lambda: re.findall('a', 'aaa'))()
*** NameError: name 're' is not defined
(Pdb) import re
(Pdb) (lambda: re.findall('a', 'aaa'))()
*** NameError: name 're' is not defined
(Pdb) 

With the commented out breakpoint it works:

> /home/yuri/_/a.py(3)()
-> def f():
(Pdb) import re
(Pdb) (lambda: re.findall('a', 'aaa'))()
['a', 'a', 'a']
(Pdb) 

Also it works with uncommented global import and second breakpoint:

['a', 'a', 'a']
> /srv/http/sl/makosh/a.py(7)f()
-> print('test')
(Pdb) (lambda: re.findall('a', 'aaa'))()
['a', 'a', 'a']
(Pdb) 

>From what I can see the issue occurs when there's no `re` in `globals` 
>argument here: https://github.com/python/cpython/blob/v3.6.4/Lib/pdb.py#L376

I've run into it when trying to grep some object's attribute names, like:

!list(filter(lambda x: re.search('class', x), dir(__name__)))

--
messages: 311871
nosy: Yuri Kanivetsky
priority: normal
severity: normal
status: open
title: locally imported modules are unaccessible in lambdas in pdb
type: behavior
versions: Python 3.6

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



[issue11416] netrc module does not handle multiple entries for a single host

2018-01-16 Thread Yuri Bochkarev

Change by Yuri Bochkarev <baltazar...@gmail.com>:


--
nosy: +Yuri.Bochkarev

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



[issue32450] non-descriptive variable name

2018-01-06 Thread Yuri Kanivetsky

Yuri Kanivetsky <yuri.kanivet...@gmail.com> added the comment:

Well, it's just that I was digging into Python's code. And it took me quite a 
while to figure out what the variable holds. Running into "ndots" name 
clarified that. That generally means that variable name doesn't describe its 
content well. But I'm new to Python's code, so it might not be the case. Feel 
free to close the issue.

--

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



[issue32450] non-descriptive variable name

2017-12-29 Thread Yuri Kanivetsky

New submission from Yuri Kanivetsky <yuri.kanivet...@gmail.com>:

Not a big issue, really. At some point the code switches from "ndots" name:

https://github.com/python/cpython/blob/v3.7.0a3/Python/ast.c#L3385

to "level" name:

https://github.com/python/cpython/blob/v3.7.0a3/Python/Python-ast.c#L1671

Be it "ndots" everywhere, it could save me some time.

--
messages: 309212
nosy: Yuri Kanivetsky
priority: normal
severity: normal
status: open
title: non-descriptive variable name
type: enhancement
versions: Python 3.7

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



[issue24154] pathlib.Path.rename moves file to Path.cwd() when argument is a string

2015-05-09 Thread Yuri Teixeira

New submission from Yuri Teixeira:

from pathlib import Path
p = Path('/any/folder')
f = p / 'oldname'
f.rename('newname')

The above will rename the file 'oldname' to 'newname' but will also
move it to Path.cwd()

I thought that pathlib.Path.rename() when fed with a string would
change f.name only. I certainly did not expect the file to move. My
hypothesis is that a new Path('newname') is being created and used to
move the file so it that goes to Path.cwd() with the new name but I
don't know anything. Please disregard if this is working as intended.

The docs do not mention this behavior:
https://docs.python.org/3/library/pathlib.html#pathlib.Path.rename

I'm using Python 3.4.3 on Debian testing.

--
components: Library (Lib)
messages: 242847
nosy: yurit
priority: normal
severity: normal
status: open
title: pathlib.Path.rename moves file to Path.cwd() when argument is a string
type: behavior
versions: Python 3.4

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



[issue8844] Condition.wait() doesn't raise KeyboardInterrupt

2013-11-07 Thread Yuri Bochkarev

Changes by Yuri Bochkarev baltazar...@gmail.com:


--
nosy: +Yuri.Bochkarev

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



[issue9634] Add timeout parameter to Queue.join()

2013-11-07 Thread Yuri Bochkarev

Changes by Yuri Bochkarev baltazar...@gmail.com:


--
nosy: +Yuri.Bochkarev

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



[issue1175] .readline() has bug WRT nonblocking files

2013-11-07 Thread Yuri Bochkarev

Changes by Yuri Bochkarev baltazar...@gmail.com:


--
nosy: +Yuri.Bochkarev

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



[issue3566] httplib persistent connections violate MUST in RFC2616 sec 8.1.4.

2013-09-11 Thread Yuri Bochkarev

Changes by Yuri Bochkarev baltazar...@gmail.com:


--
nosy: +Yuri.Bochkarev

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



[issue17622] Python sets wrong pid in window properties

2013-04-03 Thread Yuri

New submission from Yuri:

When I click on Close Window button for the unresponsive python-based app 
'meld', message from window manager shows up offering to kill the non-existent 
pid. It looks like python libs set wrong pid for windows when python 
multithreading is in use by this app.

Here are my original PRs with detailed description for kde4 and meld:
https://bugs.kde.org/show_bug.cgi?id=317750
https://bugzilla.gnome.org/show_bug.cgi?id=697143

--
components: Library (Lib)
messages: 185896
nosy: yurivict
priority: normal
severity: normal
status: open
title: Python sets wrong pid in window properties
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17622
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9098] MSYS build fails with `S_IXGRP' undeclared

2011-06-11 Thread Yuri

Yuri y...@tsoft.com added the comment:

I fixed all build problems on the current MinGW32. python.exe builds ok, but 
build fails since python.exe can't find some modules after this. Not sure why.

--
keywords: +patch
nosy: +yurivict
Added file: http://bugs.python.org/file22329/python-3.2.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9098
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9953] 2 scripts running from crontab simultaneously reference the same instance of a variable

2010-09-26 Thread yuri

New submission from yuri too...@gmail.com:

Originally the problem was that one script used a logger instance initialized 
in another script, and, as a result, log entries were signed by the later one.

Setup: python 3.1.1, Suse Linux enterprise server 9

2 scripts are scheduled in crontab as follows:
*/1 * * * * /my_path/python/test1.py  /dev/null 21
*/1 * * * * /my_path/python/test2.py  /dev/null 21

Each script does:
1) gets a logger instance and adds FileHandler, 
2) prints to its log the current time and PID, 
3) prints ID of the logger instance, 
4) prints ID and value of some variable
5) sleeps for 3 sec, 
6) prints the current time again.

Result: each script prints the same IDs of the variables

test1.py
__
#!/usr/local/bin/python3
import logging
from logging import FileHandler
from datetime import datetime
import time
import os
import sys
log = logging.getLogger('MyLog1')
log.setLevel(logging.INFO)
logFilePath = os.path.join(os.path.realpath(os.path.dirname(sys.argv[0])), 
'log')
dh = FileHandler(os.path.join(logFilePath, 'log1'))
log.addHandler(dh)
someVariable = 9
log.info(str(datetime.now()) + ' PID=' + str(os.getpid()))
log.info('logger ID=' + str(id(log)))
log.info('someVariable ID=' + str(id(someVariable)) + 'value=' + 
str(someVariable))
time.sleep(3)
log.info(str(datetime.now()) + ' PID=' + str(os.getpid()))

test2.py:
_
#!/usr/local/bin/python3
import logging
from logging import FileHandler
from datetime import datetime
import time
import os
import sys
log = logging.getLogger('MyLog2')
log.setLevel(logging.INFO)
logFilePath = os.path.join(os.path.realpath(os.path.dirname(sys.argv[0])), 
'log')
dh = FileHandler(os.path.join(logFilePath, 'log2'))
log.addHandler(dh)
someVariable = 10
log.info(str(datetime.now()) + ' PID=' + str(os.getpid()))
log.info('logger ID=' + str(id(log)))
log.info('someVariable ID=' + str(id(someVariable)) + 'value=' + 
str(someVariable))
time.sleep(3)
log.info(str(datetime.now()) + ' PID=' + str(os.getpid()))

Result:

log1:
2010-09-26 15:45:01.531460 PID=5704
logger ID=182908380624
someVariable ID=7167488value=9
2010-09-26 15:45:04.535591 PID=5704

log2:
2010-09-26 15:45:01.528691 PID=5705
logger ID=182908380624
someVariable ID=7167520value=10
2010-09-26 15:45:04.534598 PID=5705

If I change value of someVariable to 9 in the both scripts, I have:

log1:
2010-09-26 15:48:01.488008 PID=6036
logger ID=182908380624
someVariable ID=7167488value=9
2010-09-26 15:48:04.491977 PID=6036

log2:
2010-09-26 15:48:01.490214 PID=6035
logger ID=182908380624
someVariable ID=7167488value=9
2010-09-26 15:48:04.494991 PID=6035

--
components: Interpreter Core
messages: 117416
nosy: yuri
priority: normal
severity: normal
status: open
title: 2 scripts running from crontab simultaneously reference the same 
instance of a variable
type: behavior
versions: Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9953
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com