[issue46096] Support PyObject interface for global variables in local scope and debugger

2021-12-16 Thread Dmitry


New submission from Dmitry :

We use the embedded Python in a multiscript environment. For example, VBS can 
execute Python code and vice versa. 

For that purpose we use a global context which is common for all running 
scripts (Python, VBS etc.) and control access to variables in that context by 
PyObject interface. 

But we faced with an issue:

1) Setting/deleting global variables in local scope are done outside of our 
control (without using PyObject interface).

2) A debugger (LOAD_NAME tag) does not see global variables in local scope.

We would like to fix that issue by adding a check for exact PyDict 
(PyDict_CheckExact) in STORE_GLOBAL, DELETE_GLOBAL and LOAD_NAME tags in 
ceval.c. 
If a global dictionary is redefined then use PyObject interface instead of 
direct PyDict one.

--
components: Interpreter Core
hgrepos: 412
messages: 408684
nosy: dzhamoytsin
priority: normal
severity: normal
status: open
title: Support PyObject interface for global variables in local scope and 
debugger
type: behavior
versions: Python 3.9

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



[issue46096] Support PyObject interface for global variables in local scope and debugger

2021-12-16 Thread Dmitry


Change by Dmitry :


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

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



[issue33770] base64 throws 'incorrect padding' exception even though the string length is a multiple of 4

2018-06-04 Thread Dmitry


New submission from Dmitry :

All base64 decoding methods fail to decode a valid base64 string, throwing 
'incorrect padding' regardless of the string padding.

Here's an example:

>>> base64.urlsafe_b64decode('AQAAQDhAAMAAQthJDczODFmZDM2LTNiOTYtNDVmYS04MjQ2LWRkYzJkMmViYjQ2YQ===')
Traceback (most recent call last):
  File "", line 1, in 
  File "/export/apps/python/3.6/lib/python3.6/base64.py", line 133, in 
urlsafe_b64decode
return b64decode(s)
  File "/export/apps/python/3.6/lib/python3.6/base64.py", line 87, in b64decode
return binascii.a2b_base64(s)
binascii.Error: Incorrect padding

The same string gets decoded without any issues using Perl's MIME::Base64 
module or Java. So far Python's base64 module is the only one that fails to 
decode it.

--
components: Extension Modules
messages: 318691
nosy: dniq
priority: normal
severity: normal
status: open
title: base64 throws 'incorrect padding' exception even though the string 
length is a multiple of 4
versions: Python 3.6

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



[issue33770] base64 throws 'incorrect padding' exception even though the string length is a multiple of 4

2018-06-04 Thread Dmitry

Dmitry  added the comment:

It doesn’t matter how many “=“ characters are appended - it’s always throwing 
the same exception :(

--

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



[issue33770] base64 throws 'incorrect padding' exception even though the string length is a multiple of 4

2018-06-04 Thread Dmitry


Dmitry  added the comment:

Apologies: apparently this particular string was given with one character 
missing in the beginning - should be 
"AAQAAQDhAAMAAQthJDczODFmZDM2LTNiOTYtNDVmYS04MjQ2LWRkYzJkMmViYjQ2YQ".

In this case, the problem is the exception itself: it's not an "incorrect 
padding" issue.

--

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



[issue33770] base64 throws 'incorrect padding' exception even though the string length is a multiple of 4

2018-06-04 Thread Dmitry


Dmitry  added the comment:

Ideally there needs to be an option to ignore non-fatal errors. Indeed, pretty 
much any string should be base64-decodeable. Take a look at Perl's MIME::Base64 
- it can decode pretty much any random string (so long as it only contains 
valid base64 characters).

--

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



[issue33770] base64 throws 'incorrect padding' exception when the issue is NOT with the padding

2018-06-04 Thread Dmitry


Change by Dmitry :


--
title: base64 throws 'incorrect padding' exception even though the string 
length is a multiple of 4 -> base64 throws 'incorrect padding' exception when 
the issue is NOT with the padding

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



[issue33770] base64 throws 'incorrect padding' exception when the issue is NOT with the padding

2018-06-05 Thread Dmitry

Dmitry  added the comment:

I think something like “invalid length” message does make more sense in this 
case than the misleading “incorrect padding”.

It would also be great if there was a way to force it to try its best at 
decoding the string. :)

--

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



[issue33770] base64 throws 'incorrect padding' exception when the issue is NOT with the padding

2018-06-05 Thread Dmitry


Dmitry  added the comment:

@taleinat - yes, that does look much better!

--

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



[issue19644] Failing of interpreter when slicing a string in MacOS X Maverics

2013-11-18 Thread Dmitry

New submission from Dmitry:

I launch python3 on MacOS X Maverics and do the following things:
a = '12345'
a[:-0]
And the interpreter (application python3) crashes with sigfault. Everything is 
OK with python2 on this computer (the same code returnes '') and with the same 
version of Python on linux computer

--
assignee: ronaldoussoren
components: Macintosh
files: Снимок экрана 2013-11-18 в 16.39.46.png
messages: 203289
nosy: ronaldoussoren, torbad
priority: normal
severity: normal
status: open
title: Failing of interpreter when slicing a string in MacOS X Maverics
versions: Python 3.3
Added file: http://bugs.python.org/file32690/Снимок экрана 2013-11-18 в 
16.39.46.png

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



[issue5950] zimport doesn't work with zipfile containing comments

2009-05-06 Thread Dmitry

New submission from Dmitry :

Synopsys:
zimport not able to import a module from zipfile if zipfile contains
comment.
Versions:
This is Zip 2.32 (June 19th 2006), by Info-ZIP
Python 2.5.2 or 2.6.2

Steps to reproduce:
create a module, create an app that imports this module.
zip the module, make sure it works. 
Run: echo "Some comments" | zip -z module.zip
the app stop working.

--
components: Interpreter Core
files: testcase.zip
messages: 87340
nosy: dsamersoff
severity: normal
status: open
title: zimport doesn't work with zipfile containing comments
versions: Python 2.5, Python 2.6
Added file: http://bugs.python.org/file13905/testcase.zip

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



[issue5950] Make zimport work with zipfile containing comments

2010-07-09 Thread Dmitry

Dmitry  added the comment:

I'm talking about internal zimport function (see attached testcase): 

i.e.

import sys;
sys.path.insert(0,'test.zip');

import test
test.testme()

doesn't work if test.zip contains comment.

--

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



[issue27055] python fails to run zipapp when zip contains comments

2016-05-18 Thread Dmitry

New submission from Dmitry:

python fails to run zipapp when zip contains comments
when zip archive downloaded from github it contains tip hash in comment. 

Python 3.5.1 (v3.5.1:37a07cee5969, Dec  6 2015, 01:38:48) [MSC v.1900 32 bit 
(Intel)] on win32

example:

```
import zipfile


if __name__ == '__main__':
with open('__main__.py', "w") as m:
  m.write("print('hello')")


zipf = zipfile.ZipFile('zipapp_bad.zip', 'w', zipfile.ZIP_DEFLATED)
#add zip comment
zipf.comment=b"123321"
zipf.write("__main__.py")
zipf.close()

zipf = zipfile.ZipFile('zipapp_good.zip', 'w', zipfile.ZIP_DEFLATED)
zipf.write("__main__.py")
zipf.close()
```

D:\pywork\zip>python zipapp_good.zip
hello

D:\pywork\zip>python zipapp_bad.zip
  File "zipapp_bad.zip", line 1
PK♥♦¶
  ^
SyntaxError: invalid syntax

--
files: attach.zip
messages: 265839
nosy: Denisov
priority: normal
severity: normal
status: open
title: python fails to run zipapp when zip contains comments
type: crash
versions: Python 3.5
Added file: http://bugs.python.org/file42894/attach.zip

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



[issue46121] Add a note to QueueListener documentation saying that SimpleQueue instances can't be used in multiprocessing scenarios

2021-12-18 Thread dmitry-bychkov


New submission from dmitry-bychkov :

Currently, documentation for QueueListener 
(https://docs.python.org/3/library/logging.handlers.html#queuelistener) says:
"""
supports receiving logging messages from a queue, such as those implemented in 
the queue or multiprocessing modules.
"""

While also saying that we can use queue.SimpleQueue as an underlying queue:

"""
The queue is not required to have the task tracking API, which means that you 
can use queue.SimpleQueue instances for queue.
"""

I think it should also say that neither queue.SimpleQueue nor 
multiprocessing.SimpleQueue instances will work if your intended use of 
QueueListener is to receive logging messages from processes spawned by 
multiprocessing module. One should use multiprocessing.Queue instance.

usage of queue.SimpleQueue will result in pickle exception.
multiprocessing.SimpleQueue lacks the API QueueListener expects from queue.

English is not my first language so I'll step aside from PR's in documentation 
:)

--
assignee: docs@python
components: Documentation
messages: 408838
nosy: docs@python, iamdbychkov
priority: normal
severity: normal
status: open
title: Add a note to QueueListener documentation saying that SimpleQueue 
instances can't be used in multiprocessing scenarios
type: enhancement
versions: Python 3.10, Python 3.11

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



[issue46163] multiprocessing logger deadlocks if used with logging.handlers.QueueHandler

2021-12-23 Thread dmitry-bychkov


New submission from dmitry-bychkov :

Hello!
If you use multiprocessing logger with logging.handlers.QueueHandler it will 
deadlock on first attempt at logging.

First attempt will initialize queue's background thread, which uses 
multiprocessing logger itself which will result in something what looks like 
deadlock :) 

There are workarounds and I'm not sure if it can be classified as a bug, 
prehaps a little note in documentation about this behaviour will do? 

I've attached example script.

--
files: logger_deadlock.py
messages: 409088
nosy: iamdbychkov
priority: normal
severity: normal
status: open
title: multiprocessing logger deadlocks if used with 
logging.handlers.QueueHandler
versions: Python 3.9
Added file: https://bugs.python.org/file50513/logger_deadlock.py

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



[issue45767] Fix types for dev_t processing in posix module

2022-01-20 Thread Dmitry Marakasov


Dmitry Marakasov  added the comment:

> Is device number -1 used in any context (for example as "unknown device 
> number")?

Yes, there's NODEV macro in both Linux and FreeBSD which expands to ((dev_t)-1).

--

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



[issue13323] urllib2 does not correctly handle multiple www-authenticate headers in an HTTP response

2011-11-02 Thread dmitry be

Changes by dmitry be :


--
nosy: +Dmitry.Beransky

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



[issue13413] time.daylight incorrect behavior in linux glibc

2011-11-15 Thread Dmitry Balabanov

New submission from Dmitry Balabanov :

In Europe/Moscow timezone:
>> import time
>> time.daylight
1
>>> time.timezone
-10800

But if compile and run attached program result would be:
timezone: -14400, daylight: 0

Daylight is not applicable in Europe/Moscow timezone from this winter. But 
python detect daylight flag as differences between January and July localtime. 

Why not tzset()?

--
files: daylight.c
messages: 147752
nosy: dimonb
priority: normal
severity: normal
status: open
title: time.daylight incorrect behavior in linux glibc
type: behavior
Added file: http://bugs.python.org/file23704/daylight.c

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



[issue6327] [mimetext] long lines get cut with exclamation mark and newline

2011-09-06 Thread Dmitry Simonov

Dmitry Simonov  added the comment:

Quote:
==
Notes

Note that mailservers have a 990-character limit on each line contained within 
an email message. If an email message is sent that contains lines longer than 
990-characters, those lines will be subdivided by additional line ending 
characters, which can cause corruption in the email message, particularly for 
HTML content. To prevent this from occurring, add your own line-ending 
characters at appropriate locations within the email message to ensure that no 
lines are longer than 990 characters.
==

--
nosy: +Dmitry.Simonov

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



[issue9520] Add Patricia Trie high performance container

2010-08-13 Thread Dmitry Chichkov

Changes by Dmitry Chichkov :


Added file: http://bugs.python.org/file18515/dc.dict.bench.0.02.py

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



[issue9520] Add Patricia Trie high performance container

2010-08-14 Thread Dmitry Chichkov

Dmitry Chichkov  added the comment:

Yes, it looks like you are right. And while there is some slight performance 
degradation, at least nothing drastic is happening up to 30M keys. Using your 
modified test:

1000 words ( 961 keys), 3609555 words/s, 19239926 lookups/s, 51 
bytes/key (0.0MB)
   1 words (9042 keys), 3390980 words/s, 18180771 lookups/s, 87 
bytes/key (0.0MB)
  10 words (   83168 keys), 3298809 words/s, 12509481 lookups/s, 37 
bytes/key (3.0MB)
 100 words (  755372 keys), 2477793 words/s, 7537963 lookups/s, 66 
bytes/key (48.0MB)
 500 words ( 3501140 keys), 2291004 words/s, 6487727 lookups/s, 57 
bytes/key (192.0MB)
1000 words ( 6764089 keys), 2238081 words/s, 6216454 lookups/s, 59 
bytes/key (384.0MB)
2000 words (13061821 keys), 2175688 words/s, 5817085 lookups/s, 61 
bytes/key (768.0MB)
5000 words (31188460 keys), 2117751 words/s, 5137209 lookups/s, 51 
bytes/key (1536.0MB)

It looks like internal memory estimates (sys.getsizeof()) are also pretty good:

Before: ['VmPeak:\t10199764 kB', 'VmSize:\t 5552416 kB']
5000 words (31188460 keys), 2117751 words/s, 5137209 lookups/s, 51 
bytes/key (1536.0MB)
After: ['VmPeak:\t10199764 kB', 'VmSize:\t 7125284 kB']
 
7 125 284 kB - 5 552 416 kB = 1 536.00391 MB

--

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



[issue8797] urllib2 basicauth broken in 2.6.5: RuntimeError: maximum recursion depth exceeded in cmp

2010-08-25 Thread Dmitry Jemerov

Dmitry Jemerov  added the comment:

I've also run into this problem after upgrading to Python 2.6.6. My code, which 
uses the same HTTPBasicAuthHandler instance for many requests to the same 
server, worked correctly with Python 2.6.2 and broke with 2.6.6. It would be 
great if zenyatta's patch to fix the regression was included in 2.6.7.
Also, unfortunately NEWS.txt doesn't mention this change at all.

--
nosy: +Dmitry.Jemerov

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



[issue9892] Event spends less time in wait() than requested

2010-09-18 Thread Dmitry Dvoinikov

New submission from Dmitry Dvoinikov :

If you request Event.wait(x), the call consistently returns in less than x 
seconds.

Sample:
-
from threading import Event
from time import time

e = Event()

before = time()
e.wait(0.1)
after = time()

print(after - before)

# under Python 3.1 prints 0.10...
# under Python 3.2 prints 0.092999...
-

--
components: Library (Lib)
messages: 116772
nosy: ddvoinikov
priority: normal
severity: normal
status: open
title: Event spends less time in wait() than requested
type: behavior
versions: Python 3.2

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



[issue9892] Event spends less time in wait() than requested

2010-09-18 Thread Dmitry Dvoinikov

Dmitry Dvoinikov  added the comment:

You are right, sorry. It's Windows XP Prof, Python 3.2a2.

The differences in OS may be the cause, but the problem doesn't appear in 3.1 
on the same machine.

--

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



[issue11328] NESTED WHILE CYCLES ERROR

2011-02-25 Thread Dmitry Negius

New submission from Dmitry Negius :

Nested "while" cycles does not work. This make impossible to write a class of 
programs with nested while cycles.

--
components: Interpreter Core
files: bug.py
messages: 129506
nosy: negius
priority: normal
severity: normal
status: open
title: NESTED WHILE CYCLES ERROR
type: compile error
versions: Python 2.6, Python 2.7, Python 3.2
Added file: http://bugs.python.org/file20903/bug.py

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



[issue11035] Segmentation fault

2011-01-28 Thread Dmitry Groshev

New submission from Dmitry Groshev :

Here is a console output:
si14@si14-work:~/repos/monitoring/root$ python2.7 server.py 

127.0.0.1 - - [2011-01-28 12:29:30] "GET /update HTTP/1.1" 200 320 "-" 
"Python-urllib/2.7"
{"seenby":[1],"received":1296207058.993983,"observer":1,"type":"ping","source":102,"time":1296207058.990101,"data":[[1296206970.543701,0.010154962539672852],[1296206980.383922,0.010203123092651367],[1296206990.222841,0.01015615463256836],[1296207000.050695,0.010264873504638672],[1296207009.876834,0.011881113052368164],[1296207019.698611,0.010120153427124023],[1296207029.519147,0.010251045227050781],[1296207039.342266,0.010113000869750977],[1296207049.167352,0.010238885879516602],[1296207058.990089,0.010174989700317383]],"class":"statistics"}
127.0.0.1 - - [2011-01-28 12:30:59] "POST / HTTP/1.1" 200 2 "-" 
"Python-urllib/2.7"
Segmentation fault
si14@si14-work:~/repos/monitoring/root$ 
I'm not sure that this is a gevent issue, so I'm posting it here. server.py 
sources are attached.

--
components: Interpreter Core
files: server.py
messages: 127266
nosy: Dmitry.Groshev
priority: normal
severity: normal
status: open
title: Segmentation fault
type: crash
versions: Python 2.7
Added file: http://bugs.python.org/file20570/server.py

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



[issue11035] Segmentation fault

2011-01-28 Thread Dmitry Groshev

Dmitry Groshev  added the comment:

I should also say that this bug appears at first time, but it doesn't make it 
less scary. The packet that crashed python was the same as the one shown and 
I've already used this tiny "server" for a day or two without modifications, so 
it seems to me that this is not my mistake.

--

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



[issue11035] Segmentation fault

2011-01-28 Thread Dmitry Groshev

Dmitry Groshev  added the comment:

Ok, I've played with this some more and got some more segmenation faults. It 
looks like a gevent problem, but I think that python shouldn't completely fall 
so easy. Here is more traces:

si14@si14-work:~/repos/monitoring/root$ python2.7 server.py 
{"seenby":[1],"received":1296208139.606481,"observer":1,"type":"ping","source":102,"time":1296208139.603046,"data":[[1296208051.083743,0.010155200958251953],[1296208060.923999,0.011048078536987305],[1296208070.76751,0.010570049285888672],[1296208080.613247,0.011930227279663086],[1296208090.454012,0.010123968124389648],[1296208100.283144,0.010128021240234375],[1296208110.114118,0.010215997695922852],[1296208119.943081,0.010147809982299805],[1296208129.774567,0.010593891143798828],[1296208139.603033,0.010541915893554688]],"class":"statistics"}
127.0.0.1 - - [2011-01-28 12:48:59] "POST / HTTP/1.1" 200 2 "-" 
"Python-urllib/2.7"
Traceback (most recent call last):
  File "evhttp.pxi", line 473, in gevent.core._http_cb_handler 
(gevent/core.c:13165)
Segmentation fault

127.0.0.1 - - [2011-01-28 12:47:30] "GET /update HTTP/1.1" 200 320 "-" 
"Python-urllib/2.7"
^CTraceback (most recent call last):
  File "server.py", line 34, in 
gevent.wsgi.WSGIServer(("localhost", 8020), printer).serve_forever()
  File "build/bdist.linux-i686/egg/gevent/baseserver.py", line 183, in 
serve_forever
TypeError: raise: arg 3 must be a traceback or None
Segmentation fault
si14@si14-work:~/repos/monitoring/root$

--

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



[issue11035] Segmentation fault

2011-01-28 Thread Dmitry Groshev

Dmitry Groshev  added the comment:

I've changed gevent.wsgi server to gevent.pywsgi and it works as expected. Now 
I switched it back to gevent.wsgi and it doesn't crash too! That's strange, but 
I understand that you can't fix it without normal backtrace. I'm sorry for the 
inconvenience.

--

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



[issue3613] base64.encodestring does not actually accept strings

2008-08-19 Thread Dmitry Dvoinikov

New submission from Dmitry Dvoinikov <[EMAIL PROTECTED]>:

This quote from base64.py:

---
bytes_types = (bytes, bytearray)  # Types acceptable as binary data
...
def encodestring(s):
"""Encode a string into multiple lines of base-64 data.

Argument and return value are bytes.
"""
if not isinstance(s, bytes_types):
raise TypeError("expected bytes, not %s" % s.__class__.__name__)
...
---

shows that encodestring method won't accept str for an argument, only
bytes. Perhaps this is by design, but then wouldn't it make sense to
change the name of the method ?

Anyway, this behavior clashes in (the least I know) xmlrpc.client, line
1168 when basic authentication is present:

---
auth = base64.encodestring(urllib.parse.unquote(auth))
---

because unquote() returns str, not bytes.

--
components: Library (Lib)
messages: 71513
nosy: ddvoinikov
severity: normal
status: open
title: base64.encodestring does not actually accept strings
type: behavior
versions: Python 3.0

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3613>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3614] typo in xmlrpc.client

2008-08-19 Thread Dmitry Dvoinikov

New submission from Dmitry Dvoinikov <[EMAIL PROTECTED]>:

In xmlrpc.client:1204:
---
headers = {}
if extra_headers:
for key, val in extra_headers:
header[key] = val
---
shouldn't it read 
---
headers[key] = val
  ^
---
?

Otherwise it bails out with 
---
NameError: global name 'header' is not defined
---

--
components: Library (Lib)
messages: 71514
nosy: ddvoinikov
severity: normal
status: open
title: typo in xmlrpc.client
type: behavior
versions: Python 3.0

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3614>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3613] base64.encodestring does not actually accept strings

2008-08-20 Thread Dmitry Dvoinikov

Dmitry Dvoinikov <[EMAIL PROTECTED]> added the comment:

> I think it probably is correct to NOT accept a string

I agree.

> it should be renamed to encodestring

Huh ? It is already called that :) IMO it should be renamed to
encodebytes or simply encode if the module is only (or most frequently)
used to encode bytes.

> Best we can do is document them.

Oh well.

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3613>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3714] nntplib module broken by str to unicode conversion

2008-08-28 Thread Dmitry Vasiliev

New submission from Dmitry Vasiliev <[EMAIL PROTECTED]>:

The following commands fail badly:

>>> from nntplib import NNTP
>>> s = NNTP("free-text.usenetserver.com")
Traceback (most recent call last):
  File "", line 1, in 
  File "/py3k/Lib/nntplib.py", line 116, in __init__
self.welcome = self.getresp()
  File "/py3k/Lib/nntplib.py", line 215, in getresp
resp = self.getline()
  File "/py3k/Lib/nntplib.py", line 209, in getline
elif line[-1:] in CRLF: line = line[:-1]
TypeError: 'in ' requires string as left operand, not bytes

Actually there are many places in nntplib module which need to be
converted to bytes, or socket input/output values need to be converted
from/to str. I think API need to be updated to pass user defined
encoding at some stages. I can make a patch later if needed.

--
components: Library (Lib)
messages: 72090
nosy: hdima
severity: normal
status: open
title: nntplib module broken by str to unicode conversion
type: crash
versions: Python 3.0

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3714>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3714] nntplib module broken by str to unicode conversion

2008-08-28 Thread Dmitry Vasiliev

Dmitry Vasiliev <[EMAIL PROTECTED]> added the comment:

I've attached the patch which adds encoding parameter to the NNTP class.

--
keywords: +patch
Added file: http://bugs.python.org/file11292/nntplib.patch

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3714>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3725] telnetlib module broken by str to unicode conversion

2008-08-29 Thread Dmitry Vasiliev

New submission from Dmitry Vasiliev <[EMAIL PROTECTED]>:

Simple example:

>>> from telnetlib import Telnet
>>> t = Telnet("google.com", 80)
>>> t.write("GET / HTTP/1.1\r\n")
Traceback (most recent call last):
  File "", line 1, in 
  File "/py3k/Lib/telnetlib.py", line 280, in write
self.sock.sendall(buffer)
TypeError: sendall() argument 1 must be string or buffer, not str
>>> t.write(b"GET / HTTP/1.1\r\n")
Traceback (most recent call last):
  File "", line 1, in 
  File "/py3k/Lib/telnetlib.py", line 277, in write
if IAC in buffer:
TypeError: Type str doesn't support the buffer API

--
components: Library (Lib)
messages: 72131
nosy: hdima
severity: normal
status: open
title: telnetlib module broken by str to unicode conversion
type: crash
versions: Python 3.0

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3725>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3725] telnetlib module broken by str to unicode conversion

2008-08-29 Thread Dmitry Vasiliev

Dmitry Vasiliev <[EMAIL PROTECTED]> added the comment:

I think only bytes need to be allowed for write() and read*() because of
low-level nature of Telnet. I can create a patch later.

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3725>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3727] poplib module broken by str to unicode conversion

2008-08-29 Thread Dmitry Vasiliev

New submission from Dmitry Vasiliev <[EMAIL PROTECTED]>:

Example:

>>> from poplib import POP3
>>> p = POP3("localhost")
>>> p.user("user")
Traceback (most recent call last):
  File "", line 1, in 
  File "/py3k/Lib/poplib.py", line 179, in user
return self._shortcmd('USER %s' % user)
  File "/py3k/Lib/poplib.py", line 151, in _shortcmd
self._putcmd(line)
  File "/py3k/Lib/poplib.py", line 98, in _putcmd
self._putline(line)
  File "/py3k/Lib/poplib.py", line 91, in _putline
self.sock.sendall('%s%s' % (line, CRLF))
TypeError: sendall() argument 1 must be string or buffer, not str
>>> p.user(b"user")
Traceback (most recent call last):
  File "", line 1, in 
  File "/py3k/Lib/poplib.py", line 179, in user
return self._shortcmd('USER %s' % user)
  File "/py3k/Lib/poplib.py", line 151, in _shortcmd
self._putcmd(line)
  File "/py3k/Lib/poplib.py", line 98, in _putcmd
self._putline(line)
  File "/py3k/Lib/poplib.py", line 91, in _putline
self.sock.sendall('%s%s' % (line, CRLF))
TypeError: sendall() argument 1 must be string or buffer, not str

--
components: Library (Lib)
messages: 72136
nosy: hdima
severity: normal
status: open
title: poplib module broken by str to unicode conversion
type: crash
versions: Python 3.0

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3727>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3728] imaplib module broken by str to unicode conversion

2008-08-29 Thread Dmitry Vasiliev

New submission from Dmitry Vasiliev <[EMAIL PROTECTED]>:

Example:

>>> from imaplib import IMAP4
>>> m = IMAP4("localhost")
Traceback (most recent call last):
  File "", line 1, in 
  File "/py3k/Lib/imaplib.py", line 185, in __init__
self.welcome = self._get_response()
  File "/py3k/Lib/imaplib.py", line 912, in _get_response
if self._match(self.tagre, resp):
  File "/py3k/Lib/imaplib.py", line 1021, in _match
self.mo = cre.match(s)
TypeError: can't use a string pattern on a bytes-like object
>>> m = IMAP4(b"localhost")
Traceback (most recent call last):
  File "", line 1, in 
  File "/py3k/Lib/imaplib.py", line 185, in __init__
self.welcome = self._get_response()
  File "/py3k/Lib/imaplib.py", line 912, in _get_response
if self._match(self.tagre, resp):
  File "/py3k/Lib/imaplib.py", line 1021, in _match
self.mo = cre.match(s)
TypeError: can't use a string pattern on a bytes-like object

--
components: Library (Lib)
messages: 72137
nosy: hdima
severity: normal
status: open
title: imaplib module broken by str to unicode conversion
type: crash
versions: Python 3.0

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3728>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3728] imaplib module broken by str to unicode conversion

2008-08-29 Thread Dmitry Vasiliev

Dmitry Vasiliev <[EMAIL PROTECTED]> added the comment:

Ah, yes.

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3728>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3714] nntplib module broken by str to unicode conversion

2008-09-08 Thread Dmitry Vasiliev

Dmitry Vasiliev <[EMAIL PROTECTED]> added the comment:

Actually RFC-977 said all characters must be in ASCII, but RFC-3977
changed default character set to UTF-8. So I think UTF-8 must be default
encoding, not Latin-1. Moreover Latin-1 can silently hide a real
encoding, for example:

>>> u'\u0422\u0435\u0441\u0442'.encode("koi8-r").decode("latin1")
u'\xf4\xc5\xd3\xd4'

Additionally in the future it would be a good idea to look in the
article headers for article body encoding.

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3714>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3714] nntplib module broken by str to unicode conversion

2008-09-08 Thread Dmitry Vasiliev

Dmitry Vasiliev <[EMAIL PROTECTED]> added the comment:

If I understand it correctly there is no "character set used by server"
because every article can be in different encoding. RFC-3977 say:

"""
The character set of article bodies SHOULD be indicated in the
article headers, and this SHOULD be done in accordance with MIME.
"""

But it's not always true, for example fido7.* groups known to use
"KOI-8R" encoding but I didn't find any relevant headers.

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3714>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3714] nntplib module broken by str to unicode conversion

2008-09-08 Thread Dmitry Vasiliev

Dmitry Vasiliev <[EMAIL PROTECTED]> added the comment:

RFC-3977 say the following about headers:

- The names of headers (e.g., "From" or "Subject") MUST be in
  US-ASCII.

- Header values SHOULD use US-ASCII or an encoding based on it, such
  as RFC 2047 [RFC2047], until such time as another approach has
  been standardised.  At present, 8-bit encodings (including UTF-8)
  SHOULD NOT be used because they are likely to cause
  interoperability problems.

But in practice for now there is no way to reliable find a header's
encoding.

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3714>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3935] bisect insort C implementation ignores methods on list subclasses

2008-09-26 Thread Dmitry Vasiliev

Dmitry Vasiliev <[EMAIL PROTECTED]> added the comment:

Actually it was an optimization. PyList_Insert() was used for list and
list-derived objects.

I've attached the patch which fix the issue and for me the new code
looks even cleaner than the original code.

--
keywords: +patch
nosy: +hdima
Added file: http://bugs.python.org/file11614/bisect.diff

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3935>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3935] bisect insort C implementation ignores methods on list subclasses

2008-09-26 Thread Dmitry Vasiliev

Dmitry Vasiliev <[EMAIL PROTECTED]> added the comment:

Good idea! Don't know why I didn't use it in the very first version. :-)

New patch attached.

Added file: http://bugs.python.org/file11623/bisect2.patch

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3935>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8123] TypeError in urllib when trying to use HTTP authentication

2010-03-12 Thread Dmitry Jemerov

New submission from Dmitry Jemerov :

I'm trying to download a file from a site using HTTP authentication. I'm 
subclassing FancyURLOpener, returning my credentials from the 
prompt_user_passwd() method, and using opener.retrieve() to download the file. 
I get the following error:

  File "C:/JetBrains/IDEA/build/eap/downandup.py", line 36, in download
opener.retrieve(url, os.path.join(target_path, name))
  File "C:\Python31\lib\urllib\request.py", line 1467, in retrieve
fp = self.open(url, data)
  File "C:\Python31\lib\urllib\request.py", line 1435, in open
return getattr(self, name)(url)
  File "C:\Python31\lib\urllib\request.py", line 1609, in open_http
return self._open_generic_http(http.client.HTTPConnection, url, data)
  File "C:\Python31\lib\urllib\request.py", line 1605, in _open_generic_http
response.status, response.reason, response.msg, data)
  File "C:\Python31\lib\urllib\request.py", line 1621, in http_error
result = method(url, fp, errcode, errmsg, headers)
  File "C:\Python31\lib\urllib\request.py", line 1859, in http_error_401
return getattr(self,name)(url, realm)
  File "C:\Python31\lib\urllib\request.py", line 1931, in retry_http_basic_auth
return self.open(newurl)
  File "C:\Python31\lib\urllib\request.py", line 1435, in open
return getattr(self, name)(url)
  File "C:\Python31\lib\urllib\request.py", line 1609, in open_http
return self._open_generic_http(http.client.HTTPConnection, url, data)
  File "C:\Python31\lib\urllib\request.py", line 1571, in _open_generic_http
auth = base64.b64encode(user_passwd).strip()
  File "C:\Python31\lib\base64.py", line 56, in b64encode
raise TypeError("expected bytes, not %s" % s.__class__.__name__)
TypeError: expected bytes, not str

The problem happens because _open_generic_http extracts the user password from 
the string URL, and passes the string to the b64encode method, which only 
accepts bytes and not strings. The problem happens with Python 3.1.1 for me, 
but as far as I can see it's still not fixed in the py3k branch as of now.

--
components: Library (Lib)
messages: 100938
nosy: Dmitry.Jemerov
severity: normal
status: open
title: TypeError in urllib when trying to use HTTP authentication
versions: Python 3.1

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



[issue8123] TypeError in urllib when trying to use HTTP authentication

2010-03-13 Thread Dmitry Jemerov

Dmitry Jemerov  added the comment:

from urllib.request import *

opener = FancyURLopener()
opener.retrieve("http://username:passw...@google.com/index.html";, "index.html")

--

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



[issue8228] pprint, single/multiple items per line parameter

2010-03-24 Thread Dmitry Chichkov

New submission from Dmitry Chichkov :

I've run into a case where pprint isn't really pretty. 

import pprint
pprint.PrettyPrinter().pprint([1]*100)

Prints a lengthy column of '1'; Not pretty at all. Look:

[1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1,
 1]

--
components: Library (Lib)
messages: 101672
nosy: Dmitry.Chichkov
severity: normal
status: open
title: pprint, single/multiple items per line parameter
type: feature request
versions: Python 2.6

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



[issue8228] pprint, single/multiple items per line parameter

2010-03-25 Thread Dmitry Chichkov

Dmitry Chichkov  added the comment:

Quick, dirty and utterly incorrect patch that works for me. Includes 
issue_5131.patch (defaultdict support, etc). Targets trunk (2.6), revision 
77310.

--
keywords: +patch
Added file: http://bugs.python.org/file16640/issue_8228.dirty.patch

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



[issue8228] pprint, single/multiple items per line parameter

2010-04-01 Thread Dmitry Chichkov

Dmitry Chichkov  added the comment:

Yes. This patch is nowhere near the production level. Unfortunately it works 
for me. And in the moment I don't have time to improve it further. Current 
version doesn't check the item's width upfront, there is definitely room for 
improvement. 

There is also an issue with the included issue_5131.patch - pretty-printed code 
can not be executed, unless 'defaultdict(' ')' type-specs are removed.

--

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



[issue4171] SSL handshake fails after TCP connection in getpeername()

2010-04-25 Thread Dmitry Dvoinikov

Dmitry Dvoinikov  added the comment:

The problem does not reproduce in 3.1.1 nor in 3.1.2
(either x86 or x64).

Antoine Pitrou пишет:
> Antoine Pitrou  added the comment:
> 
> What happens if you remove the call to settimeout()?
> Also, it would be nice if you could try with the latest py3k checkout. 
> There's a couple of fixes for do_handshake there (including timeout issues).
> 
> --
> nosy: +pitrou
> priority:  -> normal
> versions: +Python 3.1, Python 3.2 -Python 3.0
> 
> ___
> Python tracker 
> <http://bugs.python.org/issue4171>
> ___
>

--

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



[issue8583] Hardcoded namespace_separator in the cElementTree.XMLParser

2010-04-30 Thread Dmitry Chichkov

New submission from Dmitry Chichkov :

The namespace_separator parameter is hard coded in the cElementTree.XMLParser 
class disallowing the option of ignoring XML Namespaces with cElementTree 
library.

Here's the code example:
 from xml.etree.cElementTree import iterparse
 from StringIO import StringIO
 xml = """http://www.very_long_url.com";>"""
 for event, elem in iterparse(StringIO(xml)): print event, elem

It produces:
 end http://www.very_long_url.com}child' at 0xb7ddfa58>
 end http://www.very_long_url.com}root' at 0xb7ddfa40> 

In the current implementation local tags get forcibly concatenated with URIs 
often resulting in the ugly code on the user's side and performance degradation 
(at least due to extra concatenations and extra lengthy compare operations in 
the elements matching code).

Internally cElementTree uses EXPAT parser, which is doing namespace processing 
only optionally, enabled by providing a value for namespace_separator argument. 
This argument is hard-coded in the cElementTree: 
 self->parser = EXPAT(ParserCreate_MM)(encoding, &memory_handler, "}");

Well, attached is a patch exposing this parameter in the 
cElementTree.XMLParser() arguments. This parameter is optional and the default 
behavior should be unchanged.  Here's the test code:

import cElementTree

x = """http://www.very_long_url.com";>text"""

parser = cElementTree.XMLParser()
parser.feed(x)
elem = parser.close()
print elem

parser = cElementTree.XMLParser(namespace_separator="}")
parser.feed(x)
elem = parser.close()
print elem

parser = cElementTree.XMLParser(namespace_separator=None)
parser.feed(x)
elem = parser.close()
print elem

The resulting output:
http://www.very_long_url.com}root' at 0xb7e885f0>
http://www.very_long_url.com}root' at 0xb7e88608>


--
components: Library (Lib)
messages: 104671
nosy: dmtr
priority: normal
severity: normal
status: open
title: Hardcoded namespace_separator in the cElementTree.XMLParser
type: performance
versions: Python 2.5, Python 2.6, Python 2.7

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



[issue8583] Hardcoded namespace_separator in the cElementTree.XMLParser

2010-04-30 Thread Dmitry Chichkov

Changes by Dmitry Chichkov :


--
keywords: +patch
Added file: http://bugs.python.org/file17153/issue-8583.patch

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



[issue8583] Hardcoded namespace_separator in the cElementTree.XMLParser

2010-04-30 Thread Dmitry Chichkov

Dmitry Chichkov  added the comment:

And obviously iterparse can be either overridden in the local user code or 
patched in the library. Here's the iterparse code/test code:

import  cElementTree
from cStringIO import StringIO

class iterparse(object):
root = None
def __init__(self, file, events=None, namespace_separator = "}"):
if not hasattr(file, 'read'):
file = open(file, 'rb')
self._file = file
self._events = events
self._namespace_separator = namespace_separator
def __iter__(self):
events = []
b = cElementTree.TreeBuilder()
p = cElementTree.XMLParser(b, namespace_separator= \
self._namespace_separator)
p._setevents(events, self._events)
while 1:
  data = self._file.read(16384)
  if not data:
break
  p.feed(data)
  for event in events:
yield event
  del events[:]
root = p.close()
for event in events:
  yield event
self.root = root


x = """http://www.very_long_url.com";>text"""
context = iterparse(StringIO(x), events=("start", "end", "start-ns"))
for event, elem in context: print event, elem

context = iterparse(StringIO(x), events=("start", "end", "start-ns"), 
namespace_separator = None)
for event, elem in context: print event, elem


It produces:
start-ns ('', 'http://www.very_long_url.com')
start http://www.very_long_url.com}root' at 0xb7ccf650>
start http://www.very_long_url.com}child' at 0xb7ccf5a8>
end http://www.very_long_url.com}child' at 0xb7ccf5a8>
end http://www.very_long_url.com}root' at 0xb7ccf650>
start 
start 
end 
end 

Note the absence of URIs and ignored start-ns events in the 'space_separator = 
None' version.

--

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



[issue8583] Hardcoded namespace_separator in the cElementTree.XMLParser

2010-05-01 Thread Dmitry Chichkov

Dmitry Chichkov  added the comment:

This patch does not modify the existing behavior of the library. The 
namespace_separator parameter is optional. Parameter already exists in the 
EXPAT library, but it is hard coded in the cElementTree.XMLParser code.

Fredrik, yes, namespaces are a fundamental part of the XML information model. 
Yet an option of having them ignored is a very valuable one in the performance 
critical code.

--

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



[issue8583] Hardcoded namespace_separator in the cElementTree.XMLParser

2010-05-02 Thread Dmitry Chichkov

Dmitry Chichkov  added the comment:

I agree that the argument name choice is poor. But it have already been made by 
whoever coded the EXPAT parser which cElementTree.XMLParser wraps. So there is 
not much room here.

As to 'proposed feature have to be used with great care by users' - this s 
already taken care of. If you look - cElementTree.XMLParser class is a rather 
obscure one. As I understand it is only being used by users requiring high 
performance xml parsing for large datasets (10GB - 10TB range) in data-mining 
applications.

--

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



[issue8583] Hardcoded namespace_separator in the cElementTree.XMLParser

2010-05-02 Thread Dmitry Chichkov

Dmitry Chichkov  added the comment:

Interestingly in precisely these applications often you don't care about 
namespaces at all. Often all you need is to extract 'text' or 'name' elements 
irregardless of the namespace.

--

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



[issue4171] SSL handshake fails after TCP connection in getpeername()

2010-05-07 Thread Dmitry Dvoinikov

Dmitry Dvoinikov  added the comment:

Well, I'm sorry to bring this up again, but the problem persists
with Python 3.1.2 (x86, Windows XP). The difference with the
test script behaviour is that now it doesn't break every time.
Perhaps this is the reason I said the problem was gone.
In fact, now that I run the aforementioned script I may get

worked so far
but not here it didn't

and some other time I may get

worked so far
Traceback (most recent call last):
  File "test.py", line 23, in 
test_handshake(address, False)
  File "test.py", line 17, in test_handshake
ssl.do_handshake()
  File "C:\Python31\lib\ssl.py", line 327, in do_handshake
self._sslobj.do_handshake()
AttributeError: 'NoneType' object has no attribute 'do_handshake'

and the outcome is unpredictable. It may work many times in a row
and it may break many times in a row.

If this is of any relevance, I've had pywin32-2.14 installed since.

--
status: closed -> open

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



[issue4171] SSL handshake fails after TCP connection in getpeername()

2010-05-07 Thread Dmitry Dvoinikov

Dmitry Dvoinikov  added the comment:

Checked out and built revision 80956 of py3k against OpenSSL 0.9.8n. Here is 
the banner:

Python 3.2a0 (py3k:80956, May  8 2010, 11:31:45) [MSC v.1500 32 bit (Intel)] on 
win32

Now, the breaking script appears not to be breaking any more, even though I 
tried it in a loop, a 1000 attempts to execute were all successful. 

It seems to be fine now, thank you for your help.

--

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



[issue2832] Line numbers reported by extract_stack are offset by the #-*- encoding line

2008-05-11 Thread Dmitry Dvoinikov

New submission from Dmitry Dvoinikov <[EMAIL PROTECTED]>:

Stack trace information extracted with traceback.extract_stack is
incorrect in that the #-*- line causes double counting. For example:

#comment
from traceback import extract_stack
print("this is line", extract_stack()[-1][1])

prints 'this is line 3', but

#comment
#-*- coding: windows-1251 -*-
from traceback import extract_stack
print("this is line", extract_stack()[-1][1])

prints 'this is line 6'

--
components: Library (Lib)
messages: 66708
nosy: ddvoinikov
severity: normal
status: open
title: Line numbers reported by extract_stack are offset by the #-*- encoding 
line
type: behavior
versions: Python 3.0

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2832>
__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2833] __exit__ silences the active exception

2008-05-12 Thread Dmitry Dvoinikov

New submission from Dmitry Dvoinikov <[EMAIL PROTECTED]>:

If a context manager is used within exception handling block, the active
exception is silenced after the context block completes and __exit__ exits.

try:
raise Exception("foo")
except:
with SomeContextManager():
pass
raise # in Py2.5 throws 'foo', in Py3.0 fails with RuntimeError

--
components: Interpreter Core
messages: 66713
nosy: ddvoinikov
severity: normal
status: open
title: __exit__ silences the active exception
type: behavior
versions: Python 3.0

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2833>
__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3714] nntplib module broken by str to unicode conversion

2008-10-14 Thread Dmitry Vasiliev

Dmitry Vasiliev <[EMAIL PROTECTED]> added the comment:

Oh, you need to read the comments first:

- Use of ISO-8859-1 it's a bad idea here. See msg72776 for details.
Moreover RFC-3977 explicitly say about UTF-8, so I think we need to use
UTF-8.
- Maybe set_encoding() isn't needed but you need to have a possibility
to change encoding after object creation. Because different groups can
use different encodings. But with makefile() addition you just remove
this possibility.

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3714>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3725] telnetlib module broken by str to unicode conversion

2008-10-14 Thread Dmitry Vasiliev

Dmitry Vasiliev <[EMAIL PROTECTED]> added the comment:

The patch is good. It's exactly what I told about in msg72132.

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3725>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3890] ssl.SSLSocket.recv() implementation may not work with non-blocking sockets

2008-10-20 Thread Dmitry Dvoinikov

Changes by Dmitry Dvoinikov <[EMAIL PROTECTED]>:


--
nosy: +ddvoinikov

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3890>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4171] SSL handshake fails after TCP connection in getpeername()

2008-10-22 Thread Dmitry Dvoinikov

New submission from Dmitry Dvoinikov <[EMAIL PROTECTED]>:

If I connect a TCP socket s using regular s.connect(), then wrap it
using ssl.wrap_socket(s) and call do_handshake on the resulting SSL
socket, handshake fails in ssl.py:320 with 

AttributeError: 'NoneType' object has no attribute 'do_handshake'

The problem is that when TCP socket is being wrapped in ssl.py:116, it
is not recognized as connected by a call to getpeername(), the exception
thrown in ssl.py:116 and silenced is this:

[Errno 10057] A request to send or receive data was disallowed because
the socket is not connected and (when sending on a datagram socket using
a sendto call) no address was supplied

This is awkward, because synchronous s.connect() has just returned
successfully. Even more weird, if I insert s.getpeername() between TCP
connect() and SSL do_handshake() the latter works fine.

Here is a working sample:

---

from socket import socket, AF_INET, SOCK_STREAM
from ssl import wrap_socket, PROTOCOL_TLSv1, CERT_NONE

def test_handshake(address, WORKAROUND):

s = socket(AF_INET, SOCK_STREAM)
s.settimeout(3.0)
s.connect(address)

if WORKAROUND:
s.getpeername()

ssl = wrap_socket(s, server_side = False,
  ssl_version = PROTOCOL_TLSv1,
  cert_reqs = CERT_NONE,
  do_handshake_on_connect = False)
ssl.do_handshake()

address = ("www.amazon.com", 443)

test_handshake(address, True) # with workaround
print("worked so far")
test_handshake(address, False)
print("but not here it didn't")

---

I'm using Python 3.0rc1 under Windows.

--
components: Library (Lib)
messages: 75077
nosy: ddvoinikov
severity: normal
status: open
title: SSL handshake fails after TCP connection in getpeername()
type: behavior
versions: Python 3.0

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue4171>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4171] SSL handshake fails after TCP connection in getpeername()

2008-11-09 Thread Dmitry Dvoinikov

Dmitry Dvoinikov <[EMAIL PROTECTED]> added the comment:

1.py == test.py obviously :)

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue4171>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4171] SSL handshake fails after TCP connection in getpeername()

2008-11-09 Thread Dmitry Dvoinikov

Dmitry Dvoinikov <[EMAIL PROTECTED]> added the comment:

Same thing on Python 3.0rc2:

C:\TEMP>python test.py
worked so far
Traceback (most recent call last):
  File "1.py", line 23, in 
test_handshake(address, False)
  File "1.py", line 17, in test_handshake
ssl.do_handshake()
  File "C:\Python30\lib\ssl.py", line 327, in do_handshake
self._sslobj.do_handshake()
AttributeError: 'NoneType' object has no attribute 'do_handshake'

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue4171>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4363] Make uuid module functions usable without ctypes

2008-11-20 Thread Dmitry Vasiliev

New submission from Dmitry Vasiliev <[EMAIL PROTECTED]>:

The attached patch removes dependency on ctypes from uuid.uuid1() and
uuid.uuid4() functions.

--
components: Library (Lib)
files: uuid.patch
keywords: patch
messages: 76107
nosy: hdima
severity: normal
status: open
title: Make uuid module functions usable without ctypes
type: behavior
versions: Python 2.6
Added file: http://bugs.python.org/file12071/uuid.patch

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue4363>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4718] wsgiref package totally broken

2008-12-22 Thread Dmitry Vasiliev

New submission from Dmitry Vasiliev :

It seems the wsgiref package was copied from Python 2.* without any
modifications. There are already 3 issues about that but they only
describe a part of the problem so I decided to start a new one. The
issues was:

http://bugs.python.org/issue3348
http://bugs.python.org/issue3795
http://bugs.python.org/issue4522

The attached patch fix the problem with the following changes:

- Fixed headers handling in wsgiref/simple_server.py;

- Fixed encoding problems. Now WSGI applications must return iterable
with bytes but start_response() allow status and headers as bytes and as
strings. "wsgi.input" file-like now use BytesIO instead of StringIO;

- Fixed tests;

- Updated documentation examples;

--
components: Library (Lib)
files: wsgiref.patch
keywords: patch
messages: 78171
nosy: hdima
severity: normal
status: open
title: wsgiref package totally broken
type: crash
versions: Python 3.0
Added file: http://bugs.python.org/file12423/wsgiref.patch

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



[issue4718] wsgiref package totally broken

2008-12-22 Thread Dmitry Vasiliev

Dmitry Vasiliev  added the comment:

Antoine Pitrou wrote:
> FYI, instead of trying to do exhaustive type checking in _check_type(),
> you can just rely on duck typing and catch the TypeError:

Good point! I'll update the patch soon.

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



[issue4718] wsgiref package totally broken

2008-12-22 Thread Dmitry Vasiliev

Dmitry Vasiliev  added the comment:

Antoine Pitrou wrote:
>> If you want to change to using bytes, you're going to have to take it
>> to the Web-SIG and hash out a revision to PEP 333, which at the moment
>> requires the use of strings, period.
> 
> What was called str in 2.x has become the bytes object in py3k.
> What was called unicode in 2.x has become str in py3k.
> (roughly)

Agreed, moreover it's time for Python 3.0.1 and we need to decide -
apply a patch or just remove wsgiref completely for now. Keep wsgiref
just as nonworking piece of code is the worse solution which can made
questionable all WSGI effort.

Given that old str has been replaced by bytes in Python 3 I think the
patch is a correct implementation of the PEP from the Python 3's point
of view. To avoid confusion note about the meaning of the term *string*
can be added to the PEP later.

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



[issue4718] wsgiref package totally broken

2008-12-22 Thread Dmitry Vasiliev

Dmitry Vasiliev  added the comment:

New version of the patch:

- Now only Unicode strings are allowed as status and headers because
allowing bytes leads to big changes in wsgiref.validate and
wsgiref.handlers;

--
versions:  -Python 3.1
Added file: http://bugs.python.org/file12429/wsgiref2.patch

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



[issue4718] wsgiref package totally broken

2008-12-23 Thread Dmitry Vasiliev

Dmitry Vasiliev  added the comment:

OK, I've attached PEP-333 compatible fixes for wsgiref. I think there is
only one problem remains:

- wsgiref expects io.BytesIO as input and output streams because of
http.server module. I didn't find any restrictions on data returned by
read() method of the "wsgi.input" stream in the PEP. Maybe I've missed
some details?

Added file: http://bugs.python.org/file12431/wsgiref_pep333.patch

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



[issue4718] wsgiref package totally broken

2008-12-23 Thread Dmitry Vasiliev

Dmitry Vasiliev  added the comment:

Antoine Pitrou wrote:
> Le mardi 23 décembre 2008 à 11:15 +0000, Dmitry Vasiliev a écrit :
>> OK, I've attached PEP-333 compatible fixes for wsgiref.
> 
> I may be mistaken, but it seems that your patch forces iso-8859-1
> encoding of http bodies.

No, just as PEP said str used as a container for binary data. For 
example to return UTF-8 encoded data you can use the following code:

 def app(environ, start_response):
 ...
 return [data.encode("utf-8").decode("iso-8859-1")]

I don't like it but I guess it's strictly follow the PEP (actually I 
didn't notice this sections before):

"""
On Python platforms where the str or StringType type is in fact 
Unicode-based (e.g. Jython, IronPython, Python 3000, etc.), all 
"strings" referred to in this specification must contain only code 
points representable in ISO-8859-1 encoding (\u through \u00FF, 
inclusive). It is a fatal error for an application to supply strings 
containing any other Unicode character or code point. Similarly, servers 
and gateways must not supply strings to an application containing any 
other Unicode characters.

Again, all strings referred to in this specification must be of type str 
or StringType, and must not be of type unicode or UnicodeType. And, even 
if a given platform allows for more than 8 bits per character in 
str/StringType objects, only the lower 8 bits may be used, for any value 
referred to in this specification as a "string".
"""

We definitely need to use bytes in the future but it requires PEP update 
and some migration guide.

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



[issue4718] wsgiref package totally broken

2008-12-24 Thread Dmitry Vasiliev

Changes by Dmitry Vasiliev :


Removed file: http://bugs.python.org/file12423/wsgiref.patch

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



[issue4718] wsgiref package totally broken

2008-12-24 Thread Dmitry Vasiliev

Changes by Dmitry Vasiliev :


Removed file: http://bugs.python.org/file12429/wsgiref2.patch

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



[issue4718] wsgiref package totally broken

2008-12-24 Thread Dmitry Vasiliev

Changes by Dmitry Vasiliev :


Removed file: http://bugs.python.org/file12431/wsgiref_pep333.patch

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



[issue4718] wsgiref package totally broken

2008-12-24 Thread Dmitry Vasiliev

Dmitry Vasiliev  added the comment:

Attached new WSGI 1.0+ version of the patch.

Added file: http://bugs.python.org/file12439/wsgiref.patch

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



[issue4718] wsgiref package totally broken

2008-12-25 Thread Dmitry Vasiliev

Dmitry Vasiliev  added the comment:

Phillip J. Eby wrote:
> Graham: thanks for pointing that out; I completely forgot we already 
> *had* the migration discussion on the Web-SIG!  It just slipped my 
> mind because I didn't have any 3.0 work on the horizon.

Good to see we came to conclusion. Actually my first patch went in the 
right direction. :-)

> Dmitry: A question about the new patch.  Are bytearray and memoryview 
> objects in 3.0 really the same as bytestrings?  It seems to me that 
> allowing mutable bytes objects is a mistake from a bug-finding 
> standpoint, even if it could be a win from a performance 
> standpoint.  I think it might be better to be more restrictive to 
> start out, and then let people lobby for supporting other types, 
> rather than the other way around, where we'll never get to narrow the 
> list.  Apart from that, the patch looks pretty good.  Thank you!

Actually I thought about functionality, not performance but I think 
you're right and mutable bytes objects also can open doors for 
unexpected side effects. I'll update the patch today.

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



[issue4718] wsgiref package totally broken

2008-12-25 Thread Dmitry Vasiliev

Changes by Dmitry Vasiliev :


Removed file: http://bugs.python.org/file12439/wsgiref.patch

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



[issue4718] wsgiref package totally broken

2008-12-25 Thread Dmitry Vasiliev

Dmitry Vasiliev  added the comment:

Attached updated version of the patch.

Added file: http://bugs.python.org/file12447/wsgiref.patch

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



[issue4718] wsgiref package totally broken

2008-12-26 Thread Dmitry Vasiliev

Dmitry Vasiliev  added the comment:

Graham Dumpleton wrote:
> the check for number of arguments supplied to wsgi.input.read() is wrong as 
> it allows for an optional argument, 
> when argument is supposed to mandatory.

I think it's a good idea. I'll update the patch soon.

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



[issue4604] close() seems to have limited effect

2008-12-26 Thread Dmitry Vasiliev

Dmitry Vasiliev  added the comment:

Attached more generic version of the patch.

--
nosy: +hdima
Added file: http://bugs.python.org/file12450/io_fixes.patch

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



[issue4718] wsgiref package totally broken

2008-12-26 Thread Dmitry Vasiliev

Dmitry Vasiliev  added the comment:

Added check for wsgi.input.read() argument.

Added file: http://bugs.python.org/file12454/wsgiref2.patch

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



[issue4718] wsgiref package totally broken

2008-12-27 Thread Dmitry Vasiliev

Dmitry Vasiliev  added the comment:

Antoine Pitrou wrote:
> The patch looks ok to me, although the tests against mutable byte-like
> types are probably useless.

Hmm, it's strange because such tests was removed two versions ago (per
discussion with Phillip). But at the time they really was needed.

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



[issue4718] wsgiref package totally broken

2008-12-27 Thread Dmitry Vasiliev

Dmitry Vasiliev  added the comment:

Antoine Pitrou wrote:
>> Hmm, it's strange because such tests was removed two versions ago (per
>> discussion with Phillip). But at the time they really was needed.
> 
> Not a big deal anyway, let's keep them and we'll see.

I'm afraid I've lost your point here. Are you proposing to add back
tests for mutable bytes-like objects?

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



[issue4718] wsgiref package totally broken

2008-12-27 Thread Dmitry Vasiliev

Dmitry Vasiliev  added the comment:

Antoine Pitrou wrote:
> Why do you say they were removed? I see code like "assert
> isinstance(value, bytes)".

Support and tests for mutable "bytearray" and "memoryview" was removed.
All subclasses of "bytes" must be immutable so isinstance() should be OK
here.

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



[issue4778] Small typo in multiprocessing documentation

2008-12-30 Thread Dmitry Vasiliev

New submission from Dmitry Vasiliev :

Small typo about "call" Process.daemon flag. The patch attached.

--
assignee: georg.brandl
components: Documentation
files: multiprocessing.patch
keywords: patch
messages: 78516
nosy: georg.brandl, hdima
severity: normal
status: open
title: Small typo in multiprocessing documentation
versions: Python 3.0
Added file: http://bugs.python.org/file12491/multiprocessing.patch

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



[issue4718] wsgiref package totally broken

2009-01-02 Thread Dmitry Vasiliev

Dmitry Vasiliev  added the comment:

Graham Dumpleton wrote:
> Thus have odd situation where with Python 3.0, one could technically return 
> str as iterable, with rule that would apply would be that each str returned 
> would then be converted to bytes by way of latin-1 conversion, but for 
> bytes returned as iterable, should fail.
> 
> Not sure how this plays out in wsgiref server yet as haven't looked. 

If application return bytes instead of an iterable AssertionError will
be raised in handlers.BaseHandler.write().

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



[issue4718] wsgiref package totally broken

2009-01-03 Thread Dmitry Vasiliev

Dmitry Vasiliev  added the comment:

Antoine Pitrou wrote:
> People, does this patch look ok to you?

Oh, didn't know about -bb.
The patch looks OK for me.

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



[issue4718] wsgiref package totally broken

2009-01-03 Thread Dmitry Vasiliev

Dmitry Vasiliev  added the comment:

Antoine Pitrou wrote:
> There's another problem in that buildbot failure with the environment
> variable "NO_PROXY". We'll see if it's still there after the patch.

Strange error and it seems there is only part of the traceback. I've
already seen such "partially displayed" Python 3 traceback and error
actually can be in very different place.

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



[issue4718] wsgiref package totally broken

2009-01-03 Thread Dmitry Vasiliev

Dmitry Vasiliev  added the comment:

Antoine Pitrou wrote:
>> Strange error and it seems there is only part of the traceback. I've
>> already seen such "partially displayed" Python 3 traceback and error
>> actually can be in very different place.
> 
> If you can reproduce such a problem, please open a bug.

OK, I'll try to reproduce.

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



[issue4718] wsgiref package totally broken

2009-01-03 Thread Dmitry Vasiliev

Dmitry Vasiliev  added the comment:

Attached patch for test_urllib, possible source of the "NO_PROXY" problem.

Added file: http://bugs.python.org/file12577/no_proxy.patch

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



[issue44445] Add `site-include` install scheme path in sysconfig

2022-03-21 Thread Dmitry Shachnev


Change by Dmitry Shachnev :


--
nosy: +mitya57

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



[issue38744] python 3.8 hang in multiprocessing.Pool() locking on FreeBSD

2019-11-08 Thread Dmitry Marakasov


New submission from Dmitry Marakasov :

System: FreeBSD 12.0-RELEASE, amd64.

This simple program

from multiprocessing import Pool
from time import sleep

Pool().map(sleep, [0.01] * 10)

works fine with python 3.7, but is likely (about 20-50% probability on my 4 
core box) to hang with python 3.8. Example backtraces after interruption:

% python3.8 1.py
^CException ignored in: 
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/multiprocessing/util.py", line 201, in __call__
Process ForkPoolWorker-2:
Process ForkPoolWorker-4:
res = self._callback(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.8/multiprocessing/pool.py", line 689, in 
_terminate_pool
cls._help_stuff_finish(inqueue, task_handler, len(pool))
  File "/usr/local/lib/python3.8/multiprocessing/pool.py", line 674, in 
_help_stuff_finish
inqueue._rlock.acquire()
KeyboardInterrupt: 
Process ForkPoolWorker-3:
Process ForkPoolWorker-1:

% python3.8 1.py
^CException ignored in: 
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/multiprocessing/util.py", line 201, in __call__
Process ForkPoolWorker-3:
Process ForkPoolWorker-4:
Process ForkPoolWorker-1:
res = self._callback(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.8/multiprocessing/pool.py", line 689, in 
_terminate_pool
cls._help_stuff_finish(inqueue, task_handler, len(pool))
  File "/usr/local/lib/python3.8/multiprocessing/pool.py", line 674, in 
_help_stuff_finish
inqueue._rlock.acquire()
KeyboardInterrupt: 
Process ForkPoolWorker-2:

% python3.8 1.py
^CException ignored in: 
Process ForkPoolWorker-2:
Process ForkPoolWorker-3:
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/multiprocessing/util.py", line 201, in __call__
Process ForkPoolWorker-1:
res = self._callback(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.8/multiprocessing/pool.py", line 689, in 
_terminate_pool
cls._help_stuff_finish(inqueue, task_handler, len(pool))
  File "/usr/local/lib/python3.8/multiprocessing/pool.py", line 674, in 
_help_stuff_finish
Traceback (most recent call last):
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/multiprocessing/process.py", line 313, in 
_bootstrap
self.run()
  File "/usr/local/lib/python3.8/multiprocessing/process.py", line 313, in 
_bootstrap
self.run()
  File "/usr/local/lib/python3.8/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.8/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.8/multiprocessing/pool.py", line 114, in worker
task = get()
  File "/usr/local/lib/python3.8/multiprocessing/pool.py", line 114, in worker
task = get()
  File "/usr/local/lib/python3.8/multiprocessing/queues.py", line 355, in get
with self._rlock:
  File "/usr/local/lib/python3.8/multiprocessing/queues.py", line 355, in get
with self._rlock:
  File "/usr/local/lib/python3.8/multiprocessing/synchronize.py", line 95, in 
__enter__
return self._semlock.__enter__()
  File "/usr/local/lib/python3.8/multiprocessing/synchronize.py", line 95, in 
__enter__
return self._semlock.__enter__()
KeyboardInterrupt
KeyboardInterrupt
inqueue._rlock.acquire()
KeyboardInterrupt: 
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/multiprocessing/process.py", line 313, in 
_bootstrap
self.run()
  File "/usr/local/lib/python3.8/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.8/multiprocessing/pool.py", line 114, in worker
task = get()
  File "/usr/local/lib/python3.8/multiprocessing/queues.py", line 356, in get
res = self._reader.recv_bytes()
  File "/usr/local/lib/python3.8/multiprocessing/connection.py", line 216, in 
recv_bytes
buf = self._recv_bytes(maxlength)
  File "/usr/local/lib/python3.8/multiprocessing/connection.py", line 414, in 
_recv_bytes
buf = self._recv(4)
  File "/usr/local/lib/python3.8/multiprocessing/connection.py", line 379, in 
_recv
chunk = read(handle, remaining)
KeyboardInterrupt
Process ForkPoolWorker-4:

Related issue in FreeBSD bugzilla: 
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=241801

--
components: Library (Lib)
messages: 356243
nosy: AMDmi3
priority: normal
severity: normal
status: open
title: python 3.8 hang in multiprocessing.Pool() locking on FreeBSD
versions: Python 3.8

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



[issue43792] "bad argument to internal function" in cython

2021-04-09 Thread Dmitry Marakasov


New submission from Dmitry Marakasov :

I'm playing with adding python3.10a7 port to FreeBSD ports collection, and have 
run into similar problem with building multiple third party modules (for 
instance, yaml, yarl and pystemmer). Here's log from yaml:

running build_ext
cythoning yaml/_yaml.pyx to yaml/_yaml.c
Traceback (most recent call last):
  File "", line 1, in 
  File "setup.py", line 271, in 
setup(
  File "/usr/local/lib/python3.10/site-packages/setuptools/__init__.py", line 
153, in setup
return distutils.core.setup(**attrs)
  File "/usr/local/lib/python3.10/distutils/core.py", line 148, in setup
dist.run_commands()
  File "/usr/local/lib/python3.10/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
  File "/usr/local/lib/python3.10/distutils/dist.py", line 985, in run_command
cmd_obj.run()
  File "setup.py", line 187, in run
_build_ext.run(self)
  File 
"/usr/local/lib/python3.10/site-packages/Cython/Distutils/old_build_ext.py", 
line 186, in run
_build_ext.build_ext.run(self)
  File "/usr/local/lib/python3.10/distutils/command/build_ext.py", line 340, in 
run
self.build_extensions()
  File "setup.py", line 229, in build_extensions
ext.sources = self.cython_sources(ext.sources, ext)
  File 
"/usr/local/lib/python3.10/site-packages/Cython/Distutils/old_build_ext.py", 
line 346, in cython_sources
result = cython_compile(source, options=options,
  File "/usr/local/lib/python3.10/site-packages/Cython/Compiler/Main.py", line 
778, in compile
return compile_single(source, options, full_module_name)
  File "/usr/local/lib/python3.10/site-packages/Cython/Compiler/Main.py", line 
727, in compile_single
return run_pipeline(source, options, full_module_name)
  File "/usr/local/lib/python3.10/site-packages/Cython/Compiler/Main.py", line 
479, in run_pipeline
context = options.create_context()
  File "/usr/local/lib/python3.10/site-packages/Cython/Compiler/Main.py", line 
596, in create_context
return Context(self.include_path, self.compiler_directives,
  File "/usr/local/lib/python3.10/site-packages/Cython/Compiler/Main.py", line 
80, in __init__
from . import Builtin, CythonScope
  File 
"/usr/local/lib/python3.10/site-packages/Cython/Compiler/CythonScope.py", line 
5, in 
from .UtilityCode import CythonUtilityCode
  File 
"/usr/local/lib/python3.10/site-packages/Cython/Compiler/UtilityCode.py", line 
3, in 
from .TreeFragment import parse_from_strings, StringParseContext
  File 
"/usr/local/lib/python3.10/site-packages/Cython/Compiler/TreeFragment.py", line 
17, in 
from .Visitor import VisitorTransform
  File "Cython/Compiler/Visitor.py", line 17, in init Cython.Compiler.Visitor
  File "/usr/local/lib/python3.10/site-packages/Cython/Compiler/ExprNodes.py", 
line 4742, in 
class SliceIndexNode(ExprNode):
  File "/usr/local/lib/python3.10/site-packages/Cython/Compiler/ExprNodes.py", 
line 4939, in SliceIndexNode
get_slice_utility_code = TempitaUtilityCode.load(
  File "/usr/local/lib/python3.10/site-packages/Cython/Compiler/Code.py", line 
404, in load
return cls(**kwargs)
  File "/usr/local/lib/python3.10/site-packages/Cython/Compiler/Code.py", line 
645, in __init__
proto = sub_tempita(proto, context, file, name)
  File "/usr/local/lib/python3.10/site-packages/Cython/Compiler/Code.py", line 
638, in sub_tempita
return sub(s, **context)
  File "Cython/Tempita/_tempita.py", line 376, in Cython.Tempita._tempita.sub
  File "Cython/Tempita/_tempita.py", line 137, in 
Cython.Tempita._tempita.Template.__init__
  File "Cython/Tempita/_tempita.py", line 819, in Cython.Tempita._tempita.parse
  File "Cython/Tempita/_tempita.py", line 661, in Cython.Tempita._tempita.lex
SystemError: Python/getargs.c:2038: bad argument to internal function
*** Error code 1

--
components: Extension Modules, FreeBSD
messages: 390621
nosy: AMDmi3, koobs
priority: normal
severity: normal
status: open
title: "bad argument to internal function" in cython
versions: Python 3.10

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



[issue43792] Cython is not compatible with Python 3.10 yet: "SystemError: bad argument to internal function"

2021-04-11 Thread Dmitry Marakasov


Dmitry Marakasov  added the comment:

> This issue is a bug in Cython, not in Python. I close it.

This is correct, thanks! The problem is gone with git master version of cython.

--

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



[issue44299] Enable control over daemon flag in ThreadPoolExecutor and ProcessPoolExecutor

2021-06-03 Thread Dmitry Kropachev


New submission from Dmitry Kropachev :

ThreadPoolExecutor and ProcessPoolExecutor spawn threads and processes with 
default value of daemon flag, i.e. None.

In some cases it would handful to have control over daemon flag of spawned 
threads and processes.
Simple 6-line fix to enable it.

--
components: Library (Lib)
messages: 394993
nosy: dkropachev
priority: normal
severity: normal
status: open
title: Enable control over daemon flag in ThreadPoolExecutor and 
ProcessPoolExecutor
versions: Python 3.10, Python 3.11, Python 3.9

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



[issue44299] Enable control over daemon flag in ThreadPoolExecutor and ProcessPoolExecutor

2021-06-03 Thread Dmitry Kropachev


Change by Dmitry Kropachev :


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

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



[issue39679] functools: singledispatchmethod doesn't work with classmethod

2021-06-16 Thread Dmitry Kulazhenko


Dmitry Kulazhenko  added the comment:

Based on what I've read, workaround:


from functools import singledispatchmethod


def _register(self, cls, method=None):
if hasattr(cls, "__func__"):
setattr(cls, "__annotations__", cls.__func__.__annotations__)
return self.dispatcher.register(cls, func=method)


singledispatchmethod.register = _register

--
nosy: +dmkulazhenko -EugenePY, FFY00, Viktor Roytman, glyph, levkivskyi, 
lukasz.langa, markgrandi, mental, ncoghlan, xtreak

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



[issue39679] functools: singledispatchmethod doesn't work with classmethod

2021-06-16 Thread Dmitry Kulazhenko


Change by Dmitry Kulazhenko :


--
nosy: +EugenePY, FFY00, Viktor Roytman, glyph, levkivskyi, lukasz.langa, 
markgrandi, mental, ncoghlan, xtreak

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



  1   2   3   4   >