[issue45930] Lambda function bug

2021-11-29 Thread Valery Lovchikov


New submission from Valery Lovchikov :

Python 3.9.7 (default, Sep 10 2021, 14:59:43) 
[GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> f=[lambda x: y**x for y in [2,3]]
>>> f[0](2)
9
>>> f[1](2)
9
=
I expected 4 as a result of f[0](2), but got 9

--
messages: 407293
nosy: lvch
priority: normal
severity: normal
status: open
title: Lambda function bug
versions: Python 3.9

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



[issue13133] FD leaks in ZipFile.read(), ZipFile.extract() and also using explicit arc_member.close()

2011-10-09 Thread Valery Khamenya

Valery Khamenya  added the comment:

Amaury, I followed your advice. All relevant changes of 3.2 are backported via 
the patch attached.

P.S. now I can install Twisted using pypy too. "pypy setup.py install" works 
fine for me.

--
keywords: +patch
status: pending -> open
Added file: http://bugs.python.org/file23354/zipfile.patch

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



[issue13133] FD leaks in ZipFile.read(), ZipFile.extract() and also using explicit arc_member.close()

2011-10-08 Thread Valery Khamenya

Valery Khamenya  added the comment:

"I can't reproduce this problem in either 2.7.2 or 3.3.0a0."

You probably mean CPython implementation of Python. No, I didn't mean this 
implementation.

"Do you mean that this problem is only reproducible when the attached
script is run with pypy?"

I can't say "only". I just could say yes, it is reproducible with pypy. 
Perhaps, there are others Python implementations that will suffer from the bug 
in current implementation of ZipFile

--

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



[issue13131] FD leak in urllib2

2011-10-08 Thread Valery Khamenya

Valery Khamenya  added the comment:

the problem seems to be fixed with the patch attached. 
Thanks go to fijal@freenode

--
keywords: +patch
Added file: http://bugs.python.org/file23348/urllib2.patch

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



[issue13133] FD leaks in ZipFile.read(), ZipFile.extract() and also using explicit arc_member.close()

2011-10-08 Thread Valery Khamenya

New submission from Valery Khamenya :

The attached file reproduces 3 types of FD leaks and leads to the error like:

IOError: [Errno 24] Too many open files: '/tmp/1019'

For example if executed with pypy.

--
components: IO, Library (Lib)
files: zipfiletest.py
messages: 145182
nosy: Valery.Khamenya
priority: normal
severity: normal
status: open
title: FD leaks in ZipFile.read(), ZipFile.extract() and also using explicit 
arc_member.close()
type: resource usage
versions: Python 2.7
Added file: http://bugs.python.org/file23347/zipfiletest.py

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



[issue13131] FD leak in urllib2

2011-10-08 Thread Valery Khamenya

Valery Khamenya  added the comment:

by the way, timeout parameter should be set to 0.2 as for my 13Mbit ADSL line. 
With 0.002 it is not reproducible for my environment

--

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



[issue13131] FD leak in urllib2

2011-10-08 Thread Valery Khamenya

New submission from Valery Khamenya :

Explanation from dablitz's comment at https://bugs.pypy.org/issue867 :


urllib2 in the stdlib leaks fd's if an exception is raised while opening a 
connection. The issue occurs due to a socket being opened then an exception 
being raised before an object with the socket is returned, leaving no way to 
explicitly close the object. On cpython this would not be an issue as the 
object would lose all references almost immediately however it lingers around 
with a proper GC causing FD's to build up if the same condition happens 
repeatedly (eg a loop/web crawling)

The file enclosed is a script to generate the leakage, to run invok it as 
follows  leak.py

pypy should start leaking FD's and can be see in /proc//fd



Related issues:
http://bugs.python.org/issue3066
http://bugs.python.org/issue1208304
http://bugs.python.org/issue1601399

--
components: IO, Library (Lib)
files: leak.py
messages: 145166
nosy: Valery.Khamenya
priority: normal
severity: normal
status: open
title: FD leak in urllib2
type: resource usage
versions: Python 2.7
Added file: http://bugs.python.org/file23344/leak.py

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



[issue12955] urllib.request example should use "with ... as:"

2011-09-16 Thread Valery Khamenya

Valery Khamenya  added the comment:

Guys, in my item 2 the simplistic goal was stated clearly: open, read and close.

Do you confirm that this basic sequence is not supported by urllib2 under 2.7 ?

(I just requested for a tiny documentation update entry)

regards,
Valery

--

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



[issue12955] urllib2.build_opener().open() is not friendly to "with ... as:"

2011-09-16 Thread Valery Khamenya

Valery Khamenya  added the comment:

Terry, Senthil, thanks, for replying to this ticket. OK, to the question:

1. @Terry, here is the full example as for CPython 2.7 I am talking about and 
the output:

#

from urllib2 import Request, build_opener

request = Request('http://example.com')

with build_opener().open(request) as f:
txt = f.read()
print '%d characters fetched' % len(txt)


Traceback (most recent call last):
  File "", line 1, in 
AttributeError: addinfourl instance has no attribute '__exit__'


2. @Senthil, regarding the statement being a feature. I assume, that to open a 
connection, to read from a connection and to close it -- are the fundamental 
functions for what urllib2 was in particular created for. I was looking in docs 
for some hints of "canonical" way of doing this using urllib2.opener. After I 
have failed to find any guidance in docs, I've created this ticket. That is, I 
assume that no new feature is needed, but just a documented 5-lines example 
about a typical way of doing the above operations, especially *closing* the 
connection.

regards,
Valery

--

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



[issue12955] urllib2.build_opener().open() is not friendly to "with ... as:"

2011-09-10 Thread Valery Khamenya

New submission from Valery Khamenya :

The following intuitive construction

with urllib2.build_opener().open() as:
...

leads to AttributeError: addinfourl instance has no attribute '__exit__'

http://docs.python.org/library/urllib2.html says almost nothing about concept 
of closing.

Could it be possible to add a canonical "with ... as:" example for 
urllib2.build_opener() ?

Thanks,
Valery

--
assignee: docs@python
components: Documentation, IO, Library (Lib)
messages: 143836
nosy: Valery.Khamenya, docs@python
priority: normal
severity: normal
status: open
title: urllib2.build_opener().open() is not friendly to "with ... as:"
type: resource usage
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4

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



[issue10351] Add autocompletion for keys in dictionaries

2010-11-18 Thread Valery Khamenya

Valery Khamenya  added the comment:

Guys, do you expect anythig else from me in respect to this issue? Let me know 
it before my non-stopable garbage collector wipes all the details from my brain 
away :)

--

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



[issue10351] Add autocompletion for keys in dictionaries

2010-11-09 Thread Valery Khamenya

Valery Khamenya  added the comment:

Hi Éric, thanks for guiding. 

So, attached is the concatenation of two forward unified diffs for 
rlcompleter.py and test_rlcompleter.py -- both as of py3k trunk. Tested against 
Python 3.1.2 though.

P.S. hm, py3k code appeared to be surprisingly nicer -- no unicode troubles and 
work-arounds at all...

regards
Valery

--
assignee:  -> d...@python
components: +Documentation
keywords: +patch
nosy: +d...@python
Added file: http://bugs.python.org/file19555/patch.diff

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



[issue10352] rlcompleter.py has no tests in trunk

2010-11-08 Thread Valery Khamenya

New submission from Valery Khamenya :

rlcompleter.py has no test_rlcompleter in trunk, see 
http://svn.python.org/view/python/trunk/Lib/test/
There is one in 2.7 though.

Remark: the issue http://bugs.python.org/issue10351 introduces autocompletion 
patch and comes with new tests. So, one may want to use it as for up-to-date 
test_rlcompleter.py, given the issue #10351 is accepted ;-)

--
components: Library (Lib), Tests
messages: 120722
nosy: Valery.Khamenya
priority: normal
severity: normal
status: open
title: rlcompleter.py has no tests in trunk
versions: Python 2.6

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



[issue10351] to introduce autocompletion for keys in dictionaries (patch attached)

2010-11-08 Thread Valery Khamenya

New submission from Valery Khamenya :

1. The patch introduces autocompletion for keys in dictionaries (patch attached)

2. The patched rlcompleter as such works OK for unicode dictionary keys as 
well. All tests pass OK. HOWEVER, readline's completion mechanism seem to be 
confused with unicode strings -- see comments to Completer.dict_key_matches(). 
So, perhaps, one day some changes should be applied to readline code too.

3. rlcompleter.py has no tests in trunk -- I spawn a separate issue for it. 
Meanwhile I took test_rlcompleter.py from 2.7 and extended it.

4. The following usual lines in .pythonstartup:
import readline
import rlcompleter
readline.parse_and_bind('tab: complete')
readline.parse_and_bind('Control-Space: complete')

should be extended by this one:
readline.set_completer_delims(re.compile(r'[\'"\\[]').sub('', 
readline.get_completer_delims()))

--
components: Library (Lib)
files: rlcompleter-dict-keys-autocompletion.tar.gz
messages: 120721
nosy: Valery.Khamenya
priority: normal
severity: normal
status: open
title: to introduce autocompletion for keys in dictionaries (patch attached)
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3
Added file: 
http://bugs.python.org/file19540/rlcompleter-dict-keys-autocompletion.tar.gz

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



[issue10082] PyRun_SimpleFile crashes application

2010-10-13 Thread Valery Lesin

Valery Lesin  added the comment:

OS: windows xp
Compiler: MSVC versions 7.1, 8.0 and 9.0 

Actually, the difference in compiler for python library and client applications 
causes the problem (I suppose that even same compiler with different options 
could give binary incompatible FILE structures).

--

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



[issue10082] PyRun_SimpleFile crashes application

2010-10-13 Thread Valery Lesin

New submission from Valery Lesin :

All the functions in Python/C API for file execution (like PyRun_SimpleFile) 
crash the application.

Some thoughts about problem: these functions use FILE* as first parameter which 
is binary incompatible with different CRT (python.dll and application could use 
different ones). 

Some thoughts about solution: maybe it's possible to pass only filename and 
python will open (and close) file itself? Second idea is to use functions like 
PyFile_FromString (like in Python 2)

--
components: Extension Modules, Windows
messages: 118506
nosy: Valery.Lesin
priority: normal
severity: normal
status: open
title: PyRun_SimpleFile crashes application
type: crash
versions: Python 3.1

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



[issue10081] 'import' operator doesn't work with unicode non 7-bit ASCII module names (OS: windows)

2010-10-13 Thread Valery Lesin

New submission from Valery Lesin :

OS: windows

The attempt to import module with non 7-bit ASCII name results in 
'ImportError: No module named ' exception.


Some thoughts: import.c uses functions like fopen, stat and FindFirstFile which 
wouldn't work correctly with non 7-bit ASCII filenames in Windows.

--
components: Interpreter Core, Unicode
messages: 118505
nosy: Valery.Lesin
priority: normal
severity: normal
status: open
title: 'import' operator doesn't work with unicode non 7-bit ASCII module names 
(OS: windows)
type: behavior
versions: Python 3.1, Python 3.2

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



[issue10068] global objects created in some module are not destroyed when last reference to that module is released

2010-10-12 Thread Valery Lesin

New submission from Valery Lesin :

Interpreter: Python 3.1.2

Sample:

= first.py =
import sys
import second 

if 'second' in sys.modules:
  print ('in sys modules')
  del sys.modules['second']

del second

= second.py =
class A:
 def __init__(self):
   print('created')

 def __del__(self):
   print('destroyed')

a = A()
-

Result: 'destroyed' isn't printed
With Python 2.6.5 it worked fine

--
components: Interpreter Core
messages: 118408
nosy: Valery.Lesin
priority: normal
severity: normal
status: open
title: global objects created in some module are not destroyed when last 
reference to that module is released
type: behavior
versions: Python 3.1, Python 3.2

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



[issue7052] "from logging import *" causes an error under Ubuntu Karmic

2009-10-04 Thread Valery

Valery  added the comment:

I have just installed python2.5 in addition. 
And there is no this issue with it.
So, it rather speific to python2.6

--

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



[issue7052] "from logging import *" causes an error under Ubuntu Karmic

2009-10-04 Thread Valery

New submission from Valery :

Hi all

(I never filed a bug, so, I am not sure that all fields are OK)

Anyway, here is the self explaining issue: 

$ python 
Python 2.6.3 (r263:75183, Oct  3 2009, 11:20:50) 
[GCC 4.4.1] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
>>> from logging import * 

Traceback (most recent call last): 
  File "", line 1, in  
AttributeError: 'module' object has no attribute 'NullHandler' 
$ uname -a 
Linux vaktop 2.6.31-11-generic #38-Ubuntu SMP Fri Oct 2 11:55:55 UTC 
2009 i686 GNU/Linux 

this issue blocks me badly :(

regards
--
Valery

--
components: Library (Lib)
messages: 93520
nosy: vak
severity: normal
status: open
title: "from logging import *" causes an error under Ubuntu Karmic
type: resource usage
versions: Python 2.6

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



[issue1712522] urllib.quote throws exception on Unicode URL

2008-12-21 Thread Valery

Valery  added the comment:

(self-answer to msg78153)
the working recipe is:
http://www.nabble.com/Re:-Problem:-neither-urllib2.quote-nor-
urllib.quote-encode-the--unicode-strings-arguments-p19823144.html

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



[issue1712522] urllib.quote throws exception on Unicode URL

2008-12-21 Thread Valery

Valery  added the comment:

Hi, gurus, can anyone then give a hint what we mortals should use in 
order to form  the URL with non-ascii symbols? We loved so much idea to 
feed our national symbols to urllib.quote as unicode string... and now 
we are quite disoriented... Thanks in advance for any comments!
Valery

--
nosy: +vak

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