[issue42527] UnicodeEncode error in BaseHttpRequestHandler class when send unicode data.

2021-08-25 Thread Carlos


Change by Carlos :


--
nosy: +jcarlosgalvezm

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



[issue42527] UnicodeEncode error in BaseHttpRequestHandler class when send unicode data.

2021-08-25 Thread Carlos


Change by Carlos :


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

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



[issue42527] UnicodeEncode error in BaseHttpRequestHandler class when send unicode data.

2021-08-25 Thread Carlos


Change by Carlos :


--
versions: +Python 3.10, Python 3.8

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



[issue42527] UnicodeEncode error in BaseHttpRequestHandler class when send unicode data.

2021-08-25 Thread Carlos


Change by Carlos :


--
versions: +Python 3.11

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



[issue6766] Cannot modify dictionaries inside dictionaries using Managers from multiprocessing

2009-08-23 Thread Carlos

New submission from Carlos :

It's not possible to modify a dict inside a dict using a manager from 
multiprocessing.

Ex:

from multiprocessing import Process,Manager

def f(d):
d['1'] = '1'
d['2']['1'] = 'Try To Write'

if __name__ == '__main__':
manager = Manager()

d = manager.dict()

d['2'] = manager.dict()

print d

p = Process(target=f, args=(d,))
p.start()
p.join()

print d

d['2'] = 5
print d

The output Under Windows 7 (32 Bits) / Python 2.6.2 (32 Bits) is:

{'2': {}}
{'1': '1', '2': {}}
{'1': '1', '2': 5}

The output is the same if you change "d['2'] = manager.dict()" to 
"d['2'] = dict()"

--
messages: 91889
nosy: carlosdf
severity: normal
status: open
title: Cannot modify dictionaries inside dictionaries using Managers from 
multiprocessing
type: behavior
versions: Python 2.6

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



[issue46175] Zero argument super() does not function properly inside generator expressions

2021-12-25 Thread Carlos Damazio


Carlos Damazio  added the comment:

By explicitly sending a type and object to the super function, it should work 
as usual, like in the file that I've just sent. I've seen this behavior before, 
it's related to Python's module reload function, which returns a new reference 
to the reloaded module. This issue is not widely known though, should be 
documented.

--
nosy: +carlosdamazio
Added file: https://bugs.python.org/file50519/superbug-fixd.py

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



[issue46175] Zero argument super() does not function properly inside generator expressions

2021-12-26 Thread Carlos Damazio


Carlos Damazio  added the comment:

Normally, users assume it's safe to use `super` without explicit arguments, 
until an undefined behavior happens, such as now. The only thing that glances 
into this issue is the observation in the docs you've provided that omitting 
the second argument (self), `super` returns an unbounded object, which is a 
super object.

I mean, there are 2 alternatives: this issue is related to a lower level 
implementation and it's another way to solve it (of which needs investigation 
of course) or state that it's required to provide such arguments in the docs.

https://docs.python.org/3.9/library/functions.html#super

In the newer docs, we are assuming that `super()` is the same as `super(cls, 
self)`, but clearly it's not.

--

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



[issue46175] Zero argument super() does not function properly inside generator expressions

2021-12-28 Thread Carlos Damazio


Carlos Damazio  added the comment:

Josh: My mistake, I've seen a similar issue, then. And agreed, I think #2 is a 
great candidate since we don't need to re-design existing structures. I don't 
know a better option... yet.

--

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



[issue2756] urllib.request.add_header fails with existing unredirected_header

2021-12-28 Thread Carlos Damazio


Carlos Damazio  added the comment:

This is the server for testing in 3.10.

--
nosy: +carlosdamazio
Added file: https://bugs.python.org/file50523/server310.py

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



[issue2756] urllib.request.add_header fails with existing unredirected_header

2021-12-28 Thread Carlos Damazio


Carlos Damazio  added the comment:

And here's the code to reproduce the bug in 3.10.

--
Added file: https://bugs.python.org/file50524/bug310.py

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



[issue38522] Py_USING_MEMORY_DEBUGGER is referenced in docs but not present in code

2021-12-28 Thread Carlos Damázio

Change by Carlos Damázio :


--
keywords: +patch
nosy: +dmzz
nosy_count: 3.0 -> 4.0
pull_requests: +28498
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30284

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



[issue26552] Failing ensure_future still creates a Task

2021-12-29 Thread Carlos Damázio

Change by Carlos Damázio :


--
keywords: +patch
nosy: +dmzz
nosy_count: 4.0 -> 5.0
pull_requests: +28501
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30287

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



[issue46194] Wrong base class for transport returned by loop.create_datagram_endpoint()

2021-12-29 Thread Carlos Damázio

Change by Carlos Damázio :


--
keywords: +patch
nosy: +dmzz
nosy_count: 2.0 -> 3.0
pull_requests: +28505
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30291

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



[issue22859] unittest.TestProgram.usageExit no longer invoked

2021-12-29 Thread Carlos Damázio

Change by Carlos Damázio :


--
keywords: +patch
nosy: +dmzz
nosy_count: 1.0 -> 2.0
pull_requests: +28507
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30293

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



[issue22859] unittest.TestProgram.usageExit no longer invoked

2021-12-29 Thread Carlos Damazio


Carlos Damazio  added the comment:

Well, to this issue, I'm going to put a PR to remove it and give it a chance 
for it to being reinstated if you folks want to.

--
nosy: +carlosdamazio -dmzz

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



[issue46194] Wrong base class for transport returned by loop.create_datagram_endpoint()

2021-12-29 Thread Carlos Damazio


Carlos Damazio  added the comment:

I think I have a fix for this, I opened a PR. Let me know if you have any 
questions.

--
nosy: +carlosdamazio

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



[issue38522] Py_USING_MEMORY_DEBUGGER is referenced in docs but not present in code

2021-12-29 Thread Carlos Damazio


Carlos Damazio  added the comment:

Opened a PR for this issue. It'll remove the mentions to the 
`Py_USING_MEMORY_DEBUGGER` since it'd been removed 5 years ago.

--
nosy: +carlosdamazio

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



[issue11108] Intermittent AttributeError when using time.strptime in threads

2011-02-03 Thread Carlos Corbacho

New submission from Carlos Corbacho :

time.strptime() intermittently (and I mean _really_ intermittently) throws an 
AttributeError.

Steps to reproduce:

Run the attached script (you may have to do this quite a lot of times; in an 
evening of trying, I could only trigger this bug once...) - this just starts 
lots of threads so that we have lots of time.strptime()'s running in parallel.

Expected:

It just keeps running every time.

Actual:

On one run, the script bailed out almost immediately -

ccorbacho@valkyrie:~/chroots/trunk/home/ccorbacho/scratch/ccorbacho$ python 
test_time.py
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib64/python2.6/threading.py", line 532, in __bootstrap_inner
self.run()
  File "test_time.py", line 13, in run
time.strptime("30 Nov 00", "%d %b %y")
AttributeError: _strptime_time

---
This is with Python 2.6.6. However, at work we have been seeing this very 
intermittently with Python 2.5 in threaded code doing time.strptime() as well 
(though we just get AttributeError: strptime, but I don't have any code I can 
provide to reproduce on 2.5), hence I'm raising the bug.

--
components: None
files: test_time.py
messages: 127822
nosy: ccorbacho
priority: normal
severity: normal
status: open
title: Intermittent AttributeError when using time.strptime in threads
type: crash
versions: Python 2.6
Added file: http://bugs.python.org/file20664/test_time.py

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



[issue7980] time.strptime not thread safe

2011-02-04 Thread Carlos Corbacho

Carlos Corbacho  added the comment:

As per my comments on Issue11108 - I suspect that PyImport_ImportModuleNoBlock 
is a bit of a red herring here - in Python 2.5 and earlier versions (well 
before PyImport_ImportModuleNoBlock was added), we have occasionally seen 
'AttributeError: strptime' from threaded code calling time.strptime(), so 
whatever this bug is, I don't believe it's caused by the call now being 
non-blocking from 2.6 onwards.

--
nosy: +ccorbacho

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



[issue8176] Interpreter crash with "double free or corruption" message

2010-03-19 Thread Carlos Ribeiro

New submission from Carlos Ribeiro :

I was running Django in development mode (python manage.py runserver 
0.0.0.0:8002). I saved a python source file; Django automatically detected the 
change and reloaded the module (that's the usual behavior). Then a backtrace 
from glibc appeared in the middle of the log. Django web server kept running, 
so I assume that the bug hit a separate thread. I also assume that this is a 
Python bug due to the nature of the trace (came from glibc). That's all 
information that I have.

 python version 
Python 2.6.4 (r264:75706, Dec  7 2009, 18:45:15) 
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.

 trace 
Django version 1.1.1, using settings 'camg.settings'
Development server is running at http://0.0.0.0:8002/
Quit the server with CONTROL-C.
[18/Mar/2010 22:50:23] "GET / HTTP/1.1" 200 27012
[18/Mar/2010 22:50:23] "GET /static/css/camg.css HTTP/1.1" 304 0
[18/Mar/2010 22:50:23] "GET /static/images/consorciomg.png HTTP/1.1" 304 0
[18/Mar/2010 22:52:01] "GET /andar/SEC1-3/ HTTP/1.1" 200 6441
[18/Mar/2010 22:52:06] "GET /switch/SEC1-3-3A-SA01/ HTTP/1.1" 200 6546
[18/Mar/2010 22:52:11] "GET /sala/3/ HTTP/1.1" 500 69619
[18/Mar/2010 22:52:13] "GET /switch/SEC1-3-3A-SA01/ HTTP/1.1" 200 6546
*** glibc detected *** /usr/bin/python: double free or corruption (out): 
0xb7651b80 ***
=== Backtrace: =
/lib/tls/i686/cmov/libc.so.6[0x17aff1]
/lib/tls/i686/cmov/libc.so.6[0x17c6f2]
/lib/tls/i686/cmov/libc.so.6(cfree+0x6d)[0x17f7cd]
/usr/bin/python[0x80b9ceb]
/usr/bin/python[0x808e622]
/usr/bin/python[0x808e634]
/usr/bin/python[0x806a42b]
/usr/bin/python[0x808e634]
/usr/bin/python[0x808cf19]
/usr/bin/python(PyDict_SetItem+0x87)[0x808f377]
/usr/bin/python(_PyModule_Clear+0x99)[0x8090c49]
/usr/bin/python(PyImport_Cleanup+0x459)[0x80edaf9]
/usr/bin/python(Py_Finalize+0xa5)[0x80fa305]
/usr/bin/python[0x80f9daf]
/usr/bin/python(PyErr_PrintEx+0x18d)[0x80f9f9d]
/usr/bin/python(PyErr_Print+0x12)[0x80fa1d2]
/usr/bin/python(PyRun_SimpleFileExFlags+0x1ab)[0x80facfb]
/usr/bin/python(Py_Main+0xaa8)[0x805c8d8]
/usr/bin/python(main+0x1b)[0x805baeb]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6)[0x126b56]
/usr/bin/python[0x805ba31]
=== Memory map: 
0011-0024e000 r-xp  08:01 553
/lib/tls/i686/cmov/libc-2.10.1.so
0024e000-0024f000 ---p 0013e000 08:01 553
/lib/tls/i686/cmov/libc-2.10.1.so
0024f000-00251000 r--p 0013e000 08:01 553
/lib/tls/i686/cmov/libc-2.10.1.so
00251000-00252000 rw-p 0014 08:01 553
/lib/tls/i686/cmov/libc-2.10.1.so
00252000-00255000 rw-p  00:00 0 
00255000-00382000 r-xp  08:01 3085   
/lib/i686/cmov/libcrypto.so.0.9.8
00382000-0038a000 r--p 0012c000 08:01 3085   
/lib/i686/cmov/libcrypto.so.0.9.8
0038a000-00397000 rw-p 00134000 08:01 3085   
/lib/i686/cmov/libcrypto.so.0.9.8
00397000-0039b000 rw-p  00:00 0 
0039b000-003bc000 r-xp  08:01 1749   /usr/lib/libpq.so.5.2
003bc000-003bd000 r--p 0002 08:01 1749   /usr/lib/libpq.so.5.2
003bd000-003be000 rw-p 00021000 08:01 1749   /usr/lib/libpq.so.5.2
003be000-003c r-xp  08:01 560/lib/libcom_err.so.2.1
003c-003c1000 r--p 1000 08:01 560/lib/libcom_err.so.2.1
003c1000-003c2000 rw-p 2000 08:01 560/lib/libcom_err.so.2.1
003c2000-003e8000 r-xp  08:01 1307   /usr/lib/libk5crypto.so.3.1
003e8000-003e9000 ---p 00026000 08:01 1307   /usr/lib/libk5crypto.so.3.1
003e9000-003ea000 r--p 00026000 08:01 1307   /usr/lib/libk5crypto.so.3.1
003ea000-003eb000 rw-p 00027000 08:01 1307   /usr/lib/libk5crypto.so.3.1
003eb000-003f1000 r-xp  08:01 914/usr/lib/libkrb5support.so.0.1
003f1000-003f2000 r--p 5000 08:01 914/usr/lib/libkrb5support.so.0.1
003f2000-003f3000 rw-p 6000 08:01 914/usr/lib/libkrb5support.so.0.1
003f3000-0040 r-xp  08:01 4464   /usr/lib/liblber-2.4.so.2.5.1
0040-00401000 r--p c000 08:01 4464   /usr/lib/liblber-2.4.so.2.5.1
00401000-00402000 rw-p d000 08:01 4464   /usr/lib/liblber-2.4.so.2.5.1
00402000-0041a000 r-xp  08:01 4704   /usr/lib/libsasl2.so.2.0.23
0041a000-0041b000 r--p 00017000 08:01 4704   /usr/lib/libsasl2.so.2.0.23
0041b000-0041c000 rw-p 00018000 08:01 4704   /usr/lib/libsasl2.so.2.0.23
0041c000-004bf000 r-xp  08:01 4258   /usr/lib/libgnutls.so.26.14.10
004bf000-004c3000 r--p 000a2000 08:01 4258   /usr/lib/libgnutls.so.26.14.10
004c3000-004c4000 rw-p 000a6000 08:01 4258   /usr/lib/libgnutls.so.26.14.10
004c4000-004d r-xp  08:01 328860 
/usr/lib/python2.6/dist-packages/mx/DateTime/mxDateTime/mxDateTime.so
004d-004d1000 r--p b000 08:01 328860 
/usr/lib/python2.6/dist-packages/mx/DateTime/mxDateTime/mxD

[issue8176] Interpreter crash with "double free or corruption" message

2010-03-19 Thread Carlos Ribeiro

Carlos Ribeiro  added the comment:

I know I have little information but unfortunately I couldn't reproduce the
crash. Seems like a racing condition or something similar. I'll see what I
can do about it.

On Fri, Mar 19, 2010 at 07:46, STINNER Victor wrote:

>
> STINNER Victor  added the comment:
>
> Python was displaying an error: did you saw the error? I don't know where
> Django logs stderr.
>
> Could you also run Python in verbose mode? Set PYTHONVERBOSE=2 environment
> variable. It should write useful informations before the crash.
>
> --
> nosy: +haypo
>
> ___
> Python tracker 
> <http://bugs.python.org/issue8176>
> ___
>

--
Added file: http://bugs.python.org/file16584/unnamed

___
Python tracker 
<http://bugs.python.org/issue8176>
___I know I have little information but unfortunately I couldn't reproduce the 
crash. Seems like a racing condition or something similar. I'll see what I 
can do about it.On Fri, Mar 19, 2010 at 07:46, 
STINNER Victor <mailto:rep...@bugs.python.org";>rep...@bugs.python.org> 
wrote:


STINNER Victor <mailto:victor.stin...@haypocalc.com";>victor.stin...@haypocalc.com> 
added the comment:

Python was displaying an error: did you saw the error? I don't know where 
Django logs stderr.

Could you also run Python in verbose mode? Set PYTHONVERBOSE=2 environment 
variable. It should write useful informations before the crash.

--
nosy: +haypo

___
Python tracker <mailto:rep...@bugs.python.org";>rep...@bugs.python.org>
<http://bugs.python.org/issue8176"; 
target="_blank">http://bugs.python.org/issue8176>
___
-- Carlos 
RibeiroConsultoria em Projetostwitter: http://twitter.com/carribeiro";>http://twitter.com/carribeiroblog: 
http://rascunhosrotos.blogspot.com";>http://rascunhosrotos.blogspot.com

mail: mailto:carribe...@gmail.com";>carribe...@gmail.com
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8176] Interpreter crash with "double free or corruption" message

2010-03-21 Thread Carlos Ribeiro

Carlos Ribeiro  added the comment:

Thanks for investigating!

I'll keep watching. I'm currently developing a small Django app, and the
crash happened during one of the automatic reloads that the development
server do whenever a source code file changes. The problem is that I
probably ran through the same procedure several hundred times over the past
few weeks, but the bug happened only *once*. Seems like a nasty bug. I
*suspect* it may be thread related, a racing condition or something like it.
(and yes, I'm using a regular build, not a debug build).

Also note that I use Python since 1998 and never, in the past 12 years, I
had a dump like this.

As for this ticket, it seems like a nasty and elusive bug; I _feel_ that we
may never see the same bug again, _but_ other people may encounter similar
situations, and we can then try to correlate them to find the cause. If I
don't manage to reproduce it over the next few days we may close it but keep
it in the tracker, until someone else hits it again.

Best regards,

Carlos Ribeiro

On Sun, Mar 21, 2010 at 16:29, Alexander Belopolsky
wrote:

>
> Alexander Belopolsky  added the comment:
>
> Clearly not enough information, but I have a few observations:
>
> 1. Clearly the crash occurs on exit (in Py_Finalize) during a module
> cleanup.  (Unfortunately it looks like a non-debug build of Python was used
> so figuring out which module is involved may be hard.
>
> 2. Memory map suggests that the crash is very late in python finalization.
>  Note that only two python modules are still mapped: mxDateTime and
> _hashlib.  However the memmap seems incomplete.
>
> Try to reproduce the crash with a debug build of python (configure
> --with-pydebug).  The debug build may also crash sooner and more reliably.
>
> --
> nosy: +Alexander.Belopolsky
>
> ___
> Python tracker 
> <http://bugs.python.org/issue8176>
> ___
>

--
Added file: http://bugs.python.org/file16615/unnamed

___
Python tracker 
<http://bugs.python.org/issue8176>
___Thanks for investigating!I'll keep watching. I'm currently 
developing a small Django app, and the crash happened during one of the 
automatic reloads that the development server do whenever a source code file 
changes. The problem is that I probably ran through the same procedure several 
hundred times over the past few weeks, but the bug happened only *once*. Seems 
like a nasty bug. I *suspect* it may be thread related, a racing condition or 
something like it. (and yes, I'm using a regular build, not a debug 
build).

Also note that I use Python since 1998 and never, in the past 12 years, I 
had a dump like this.As for this ticket, it seems like a nasty and 
elusive bug; I _feel_ that we may never see the same bug again, _but_ other 
people may encounter similar situations, and we can then try to correlate them 
to find the cause. If I don't manage to reproduce it over the next few days 
we may close it but keep it in the tracker, until someone else hits it 
again.

Best regards,Carlos RibeiroOn 
Sun, Mar 21, 2010 at 16:29, Alexander Belopolsky <mailto:rep...@bugs.python.org";>rep...@bugs.python.org> 
wrote:


Alexander Belopolsky <mailto:alexander.belopol...@gmail.com";>alexander.belopol...@gmail.com>
 added the comment:

Clearly not enough information, but I have a few observations:

1. Clearly the crash occurs on exit (in Py_Finalize) during a module cleanup. 
 (Unfortunately it looks like a non-debug build of Python was used so figuring 
out which module is involved may be hard.

2. Memory map suggests that the crash is very late in python finalization. 
 Note that only two python modules are still mapped: mxDateTime and _hashlib. 
 However the memmap seems incomplete.

Try to reproduce the crash with a debug build of python (configure 
--with-pydebug).  The debug build may also crash sooner and more reliably.

--
nosy: +Alexander.Belopolsky

___
Python tracker <mailto:rep...@bugs.python.org";>rep...@bugs.python.org>
<http://bugs.python.org/issue8176"; 
target="_blank">http://bugs.python.org/issue8176>
___
-- Carlos 
RibeiroConsultoria em Projetostwitter: http://twitter.com/carribeiro";>http://twitter.com/carribeiroblog: 
http://rascunhosrotos.blogspot.com";>http://rascunhosrotos.blogspot.com

mail: mailto:carribe...@gmail.com";>carribe...@gmail.com
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2680] gotcha: _fields_ is final but accepts lists

2008-04-24 Thread Carlos Scheidegger

New submission from Carlos Scheidegger <[EMAIL PROTECTED]>:

When creating ctypes.Structure classes dynamically, there's a gotcha.
_fields_ is final, but it takes a list that can be appended to. I'm not
sure this is a bug, but I would argue it is a lot more surprising than
it could be:

Python 2.5.2 (r252:60911, Apr 21 2008, 11:17:30) 
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>> class Foo(ctypes.Structure):
...  _fields_ = [('dim', ctypes.c_int)]
... 
>>> x = Foo()
>>> x.dim = 1
>>> x.dim = '123' # This is ok, and expected
Traceback (most recent call last):
  File "", line 1, in 
TypeError: an integer is required
>>> 
>>> 
>>> class Bar(ctypes.Structure):
...  pass
... 
>>> x._fields_ = []
>>> x._fields_.append(('dim', ctypes.c_int))
>>> x = Bar()
>>> x.dim = '123' # This, however, is strange
>>>

This was somewhat foreseen, since _fields_ is final:

>>> class Baz(ctypes.Structure):
...  pass
... 
>>> Baz._fields_ = []
>>> Baz._fields_ = [('dim', ctypes.c_int)]
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: _fields_ is final

Would it not make sense for _fields_ to require a tuple, so that it
cannot be mutated? I realize this is a big change. Currently, ctypes
accepts tuples as the input to _fields_. Maybe a warning should be
issued when a list is assigned to _fields_?

--
assignee: theller
components: ctypes
messages: 65728
nosy: cscheid, theller
severity: normal
status: open
title: gotcha: _fields_ is final but accepts lists
type: behavior
versions: Python 2.5

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



[issue44424] Decompress streaming bz2 file

2021-06-15 Thread Carlos Franzreb


Change by Carlos Franzreb :


--
components: Library (Lib)
nosy: carlosfranzreb
priority: normal
severity: normal
status: open
title: Decompress streaming bz2 file
type: behavior
versions: Python 3.9

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



[issue44424] Decompress streaming bz2 file

2021-06-15 Thread Carlos Franzreb


New submission from Carlos Franzreb :

I am trying to lazily load items from a compressed file that resides in Zenodo. 
My goal is to iteratively yield the items without storing the file in my 
computer. My problem is that an EOFerror occurs right after the first non-empty 
line is read. How can I overcome this issue?

Here is my code:

import requests as req
import json
from bz2 import BZ2Decompressor


def lazy_load(file_url):
dec = BZ2Decompressor()
with req.get(file_url, stream=True) as res:
for chunk in res.iter_content(chunk_size=1024):
data = dec.decompress(chunk).decode('utf-8')
# do something with 'data'


if __name__ == "__main__":
creds = json.load(open('credentials.json'))
url = 'https://zenodo.org/api/records/'
id = '4617285'
filename = '10.Papers.nt.bz2'
res = req.get(f'{url}{id}', params={'access_token': 
creds['zenodo_token']})
for file in res.json()['files']:
if file['key'] == filename:
for item in lazy_load(file['links']['self']):
# do something with 'item'

The error I become is the following:

Traceback (most recent call last):
File ".\mag_loader.py", line 51, in 
  for item in lazy_load(file['links']['self']):
File ".\mag_loader.py", line 18, in lazy_load
  data = dec.decompress(chunk)
EOFError: End of stream already reache

To run the code you need a Zenodo access token, for which you need an account. 
Once you have logged in, you can create the token here: 
https://zenodo.org/account/settings/applications/tokens/new/

--

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



[issue39514] http://sphinx.pocoo.org/

2020-01-31 Thread Carlos ESTEVES


New submission from Carlos ESTEVES :

Hi,

"Sphinx" link is break on webpage: https://docs.python.org/3/

See:
http://sphinx.pocoo.org/";>Sphinx

Thank You

--
assignee: docs@python
components: Documentation
messages: 361135
nosy: cesteves, docs@python
priority: normal
severity: normal
status: open
title: http://sphinx.pocoo.org/

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



[issue1294959] Problems with /usr/lib64 builds.

2020-02-11 Thread Carlos Velasco


Change by Carlos Velasco :


--
nosy: +carlos.velasco

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



[issue41198] Round built-in function not shows zeros acording significant figures and calculates different numbers of odd and even

2020-07-02 Thread Carlos Neves


New submission from Carlos Neves :

Hi,

I am observing unexpected behavior with round built-in function about (1) 
significant figures in analytical methods and (2) number of odd and even 
numbers obtained by this function.

https://docs.python.org/3/library/functions.html#round

https://en.wikipedia.org/wiki/Significant_figures

1. Significant Figures
==

For example, when I say 1.20 in analytical methods, I am confident about the 
last digit, the zero. It has a meaning. But, when I use Python,

>>> round (1.203, 2)
1.2
>>>

the zero not appears. It is not occur when the second digit is not zero. 

>>> round (1.213, 2)
1.21
>>>

The zero should be printed like the other numbers to be consistent with the 
significant figures. Maybe other functions could present the same behavior.

2. Rounding procedure
=

I wrote the following code to test the number of odd and even numbers during a 
round procedure. I should get half-and-a-half of odd and even numbers. But the 
result using the round function is different. We observed 5 even more and 5 odd 
less. This behavior causes a systematic error.

https://en.wikipedia.org/wiki/Rounding

I hope to be contributing to the improvement of the code.

Thank advanced.


##
# This code count the number of odd and even number with different procedures: 
truncate, round simple and round function 
# Test condition: Rounding with one digit after the decimal point.

import numpy as np

even_0 = 0
odd_0 = 0

even_1 = 0
odd_1 = 0

even_2 = 0
odd_2 = 0

even_3 = 0
odd_3 = 0

# generate 1000 numbers from 0.000 up to 1 with step of 0.001
x = np.arange(0,1,0.001) 

# printing 
for i in range(len(x)): 

x_truncated = int((x[i]*10)+0.0)/10 # no rounding
x_rounded_simple = int((x[i]*10)+0.5)/10 # rounding up at 5
x_rounded_function = round(x[i],1) # rounding by function with one 
digit after the decimal point

# counting odd and even numbers
if int(x[i]*1000) % 2 == 0:
even_0 += 1
else:
odd_0 += 1

if int(x_truncated*10) % 2 == 0:
even_1 += 1
else:
odd_1 += 1

if int(x_rounded_simple*10) % 2 == 0:
even_2 += 1
else:
odd_2 += 1

if int(x_rounded_function*10) % 2 == 0:
even_3 += 1
else:
odd_3 += 1

print ("{0:.3f} {1:.1f} {2:.1f} {3:.1f}".format((x[i]), x_truncated, 
x_rounded_simple, x_rounded_function))

print ("Result:")
print ("Raw: Even={0}, Odd={1}".format(even_0,odd_0))   
print ("Truncated: Even={0}, Odd={1}".format(even_1,odd_1))
print ("Rounded simple: Even={0}, Odd={1}".format(even_2,odd_2))
print ("Rounded Function: Even={0}, Odd={1}".format(even_3,odd_3))

##

Output
...
0.995 0.9 1.0 1.0
0.996 0.9 1.0 1.0
0.997 0.9 1.0 1.0
0.998 0.9 1.0 1.0
0.999 0.9 1.0 1.0
Result:
Raw: Even=500, Odd=500
Truncated: Even=500, Odd=500
Rounded simple: Even=500, Odd=500
Rounded Function: Even=505, Odd=495



--
components: Library (Lib)
messages: 372878
nosy: Carlos Neves, lemburg, mark.dickinson, rhettinger, stutzbach
priority: normal
severity: normal
status: open
title: Round built-in function not shows zeros acording significant figures and 
calculates different numbers of odd and even
type: behavior
versions: Python 3.8

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



[issue41198] Round built-in function not shows zeros acording significant figures and calculates different numbers of odd and even

2020-07-02 Thread Carlos Neves

Carlos Neves  added the comment:

Hi Peters,

I will pay more attention to the Python docs :)
Thank you for your direction.

Carlos A. Neves

Em qui., 2 de jul. de 2020 às 18:22, Tim Peters
 escreveu:
>
>
> Tim Peters  added the comment:
>
> For the first, your hardware's binary floating-point has no concept of 
> significant trailing zeroes. If you need such a thing, use Python's `decimal` 
> module instead, which does support a "significant trailing zero" concept. You 
> would need an entirely new data type to graft such a notion onto Python's (or 
> numpy's!) binary floats.
>
> For the second, we'd have to dig into exactly what numpy's `arange()` does. 
> Very few of the numbers you're working with are exactly representable in 
> binary floating point except for 0.0. For example, "0.001" is approximated by 
> a binary float whose exact decimal value is
>
> 0.00120816681711721685132943093776702880859375
>
> Sometimes the rounded (by machine float arithmetic) multiples of that are 
> exactly representable, but usually not. For example,
>
> >>> 0.001 * 250
> 0.25
>
> rounds to the exactly representable 1/4, and
>
> >>> 0.001 * 750
> 0.75
>
> to the exactly representable 3/4. However, `round()` uses 
> round-to-nearest/even, and then
>
> >>> round(0.25, 1)
> 0.2
> >>> round(0.75, 1)
> 0.8
>
> both resolve the tie to the closest even value (although neither of those 
> _results_ are exactly representable in binary floating-point - although if 
> you go on to multiply them by 10.0, they do round (in hardware) to exactly 
> 2.0 and 8.0).
>
> Note that numpy's arange() docs do warn you against using it ;-)
>
> """
> When using a non-integer step, such as 0.1, the results will often not be 
> consistent. It is better to use numpy.linspace for these cases.
> """
>
> --
> nosy: +tim.peters
>
> ___
> Python tracker 
> <https://bugs.python.org/issue41198>
> ___

--

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



[issue37317] asyncio gather doesn't handle custom exceptions that inherit from BaseException

2019-06-17 Thread Carlos Mermingas


New submission from Carlos Mermingas :

asyncio.gather doesn't handle custom exception exceptions that inherit from 
BaseException in the same manner that it handles those that inherit from 
Exception, regardless of whether return_exceptions is set to True or False.

In the example below, I am using return_exceptions=True. If the custom 
exception inherits from Exception, a list printed, as expected. Conversely, if 
the custom exception inherits from BaseException, it is propagated:


import asyncio


class CustomException(BaseException):  # It works if base class changed to 
Exception
pass


async def do_this(x):
if x == 5:
raise CustomException()
await asyncio.sleep(1)
print(f'THIS DONE: {x}')


async def main():
print('BEGIN')
tasks = [do_this(x) for x in range(1, 11)]
result = await asyncio.gather(*tasks, return_exceptions=True)
print(f'Result: {result}')
print('END')


asyncio.run(main())

--
components: Library (Lib)
messages: 345861
nosy: cmermingas
priority: normal
severity: normal
status: open
title: asyncio gather doesn't handle custom exceptions that inherit from 
BaseException
type: behavior
versions: Python 3.7

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



[issue35812] Don't log an exception from the main coroutine in asyncio.run()

2019-02-20 Thread Carlos Damázio

Carlos Damázio  added the comment:

Hey, Andrew. I'd like to work on the issue, if anyone else hasn't done it yet.

--
nosy: +Carlos Damázio

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



[issue36121] csv: Non global alternative to csv.field_size_limit

2019-02-26 Thread Carlos Ramos


New submission from Carlos Ramos :

The function csv.field_size_limit gets and sets a global variable. It would be 
useful to change this limit in a per-reader or per-thread basis, so that a 
library can change it without affecting global state.

--
components: Extension Modules
messages: 336651
nosy: Carlos Ramos
priority: normal
severity: normal
status: open
title: csv: Non global alternative to csv.field_size_limit
type: enhancement
versions: Python 3.8

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



[issue21879] str.format() gives poor diagnostic on placeholder mismatch

2019-02-26 Thread Carlos Damázio

Carlos Damázio  added the comment:

I've noticed this issue is quite not active, but I'm up on participating in it 
if anyone is doing it already. Since then, this issue still persists:

>>> '{1}'.format()
Traceback (most recent call last):
  File "", line 1, in 
IndexError: tuple index out of range

Reading further, I agree that improving the message is suitable. We should 
leave the Index Exception while changing the text to "Replacement index %d out 
of range for positional args tuple". Even though I find it quite extent for an 
exception message, I guess it couldn't be any other way, unless someone gives a 
better suggestion.

--
nosy: +dmzz

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



[issue21879] str.format() gives poor diagnostic on placeholder mismatch

2019-02-26 Thread Carlos Damázio

Carlos Damázio  added the comment:

Ops, someone already patched it! Sorry guys.

--

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



[issue34032] Add platlibdir to allow distinction between /usr/lib and /usr/lib64 for Linux

2018-08-28 Thread Carlos Velasco


Carlos Velasco  added the comment:

This updated patch fix two missing lib/lib64
It works for me.

# python3-32 -c "import sys; print('\n'.join(sys.path))"
/usr/lib/python37.zip
/usr/lib/python3.7
/usr/lib/python3.7/lib-dynload
/root/.local/lib/python3.7/site-packages
/usr/lib/python3.7/site-packages


# python3-64 -c "import sys; print('\n'.join(sys.path))"  
/usr/lib64/python37.zip
/usr/lib64/python3.7
/usr/lib64/python3.7/lib-dynload
/root/.local/lib64/python3.7/site-packages
/usr/lib64/python3.7/site-packages

--
nosy: +carlos.velasco
Added file: https://bugs.python.org/file47766/python-3.6.0-multilib-new-3.patch

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



[issue16621] sched module enhancement request

2012-12-05 Thread Carlos Ferreira

New submission from Carlos Ferreira:

The sched module available in the Python core lacks a simple but very useful 
which is waiting for new events scheduling.

Current version only process events that are present in the queue before the 
schedule.run() is issued or for events that are schedule while the scheduler is 
still active and processing events from the queue.

I propose a simple enhancement, by using an Event object from the threading 
module, so that the thread that is running the scheduler, waits for new events 
scheduling, after finishing processing all queued events.

The sched2.py is a modified version of the original sched.py (modified by means 
of a large hammer), which adds an "alwaysRunning" argument in the object 
constructor, a self.wakeUpEvent attribute which is the Event Object, a modified 
eterabs method to call the Event.set() and finally, a modified run() to wait 
for new events.

This modification is just a quick patch in order to pass the idea of what is 
being requested here. If there is a better way to do this, then it should be 
taken.

--
components: Library (Lib)
files: sched2.py
messages: 177002
nosy: carlosmf.pt
priority: normal
severity: normal
status: open
title: sched module enhancement request
type: enhancement
versions: Python 3.3
Added file: http://bugs.python.org/file28214/sched2.py

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



[issue16621] sched module enhancement request

2012-12-05 Thread Carlos Ferreira

Changes by Carlos Ferreira :


Removed file: http://bugs.python.org/file28214/sched2.py

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



[issue16621] sched module enhancement request

2012-12-05 Thread Carlos Ferreira

Carlos Ferreira added the comment:

Sorry, wrong file issued before...

--
Added file: http://bugs.python.org/file28215/sched2.py

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



[issue20777] PyArg_ParseTupleAndKeywords does not respect arguments format.

2014-02-25 Thread Carlos Ferreira

New submission from Carlos Ferreira:

PyArg_ParseTupleAndKeywords is not respecting the format string "sy*ss"

When using the format "sbss" with the following valid arguments
"enp0s8", 0, "08:00:27:da:b3:47", "08:00:27:11:22:33"
there is no error and the function succeeds in parsing the arguments.

But when passing the following valid arguments,
"8bf2f93c-8f44-4960-a2de-71f87130882e", bytes(list([0,0,0,1])), 
"08:00:27:11:22:33", "10.0.0.3"
it will fail stating that the 3rd argument has a null character.

--
components: Extension Modules
messages: 212236
nosy: Claymore
priority: normal
severity: normal
status: open
title: PyArg_ParseTupleAndKeywords does not respect arguments format.
type: behavior
versions: Python 3.3

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



[issue20777] PyArg_ParseTupleAndKeywords does not respect arguments format.

2014-02-25 Thread Carlos Ferreira

Carlos Ferreira added the comment:

(Please ignore the previous post)

PyArg_ParseTupleAndKeywords is not respecting the format string "sy*ss"

When using the format "sbss" with the following valid arguments
"enp0s8", 0, "08:00:27:da:b3:47", "08:00:27:11:22:33"
there is no error and the function succeeds in parsing the arguments.

But when using the format "sy*ss" with the following valid arguments,
"8bf2f93c-8f44-4960-a2de-71f87130882e", bytes(list([0,0,0,1])), 
"08:00:27:11:22:33", "10.0.0.3"
it will fail stating that the 3rd argument has a null character.

--
status: open -> closed

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



[issue20777] PyArg_ParseTupleAndKeywords does not respect arguments format.

2014-02-26 Thread Carlos Ferreira

Carlos Ferreira added the comment:

Solved. This issue had nothing to do with Python API.

--

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



[issue17794] Priority Queue

2013-04-18 Thread Carlos Ferreira

New submission from Carlos Ferreira:

I'm using Priority Queues and followed the Python documentation for a simple 
example.

>From Queue documentation in Python 3.3
http://docs.python.org/3.3/library/queue.html
"
The lowest valued entries are retrieved first (the lowest valued entry is the 
one returned by sorted(list(entries))[0]). A typical pattern for entries is a 
tuple in the form: (priority_number, data).
"

Then I tried this simple code.

>>> pq = PriorityQueue()
>>> pq.put_nowait((0, {'a':1}))
>>> pq.put_nowait((0, {'a':2}))
Traceback (most recent call last):
File "", line 1, in 
File "/usr/lib/python3.3/queue.py", line 187, in put_nowait
return self.put(item, block=False)
File "/usr/lib/python3.3/queue.py", line 146, in put
self._put(item)
File "/usr/lib/python3.3/queue.py", line 230, in _put
heappush(self.queue, item)
TypeError: unorderable types: dict() < dict()

Is this a normal behaviour? I'm not sure if this should be declared as a bug...

Instead of sticking to the first argument that indicates the priority, the 
heapq algorithm checks the second field and tries to order the dictionaries.

I solved this annoyance by adding a  third field, the object ID. Since the 
object ID is actually its address in memory, every object will have a different 
ID. Also, since the queue entries will have the same priority (zero), the id 
value is used to order the tuples in the heap queue.

>>> pq = PriorityQueue()
>>> a = {'a':1}
>>> b = {'a':2}
>>> pq.put_nowait((0, id(a), a))
>>> pq.put_nowait((0, id(b), b))

--
components: Interpreter Core
messages: 187321
nosy: Claymore
priority: normal
severity: normal
status: open
title: Priority Queue
type: behavior
versions: Python 3.3

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



[issue17992] test_asynchat hangs

2013-05-15 Thread Carlos Nepomuceno

New submission from Carlos Nepomuceno:

after running 'make' i entered 'make test' and it hanged on test_asynchat. 
stayed there for more than 1 hour.

---
Python build finished, but the necessary bits to build these modules were not 
found:
_bsddb _tkinter   bsddb185
bz2dbmdl
gdbm   imageopreadline
sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the 
module's name.

running build_scripts
./python -E -c 'import sys ; from sysconfig import get_platform ; print 
get_platform()+"-"+sys.version[0:3]' >platform
find ./Lib -name '*.py[co]' -print | xargs rm -f
./python -Wd -3 -E -tt  ./Lib/test/regrtest.py -l
== CPython 2.7.5 (default, May 16 2013, 00:43:33) [GCC 4.4.7 20120313 (Red Hat 
4.4.7-3)]
==   Linux-2.6.32-279.19.1.el6.x86_64-x86_64-with-centos-6.4-Final little-endian
==   /usr/src/Python-2.7.5/build/test_python_26106
Testing with flags: sys.flags(debug=0, py3k_warning=1, division_warning=1, 
division_new=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, 
no_user_site=0, no_site=0, ignore_environment=1, tabcheck=2, verbose=0, 
unicode=0, bytes_warning=0, hash_randomization=0)
test_grammar
test_opcodes
test_dict
test_builtin
test_exceptions
test_types
test_unittest
/usr/src/Python-2.7.5/Lib/unittest/runner.py:39: DeprecationWarning: comparing 
unequal types not supported in 3.x
  self.showAll = verbosity > 1
test_doctest
test_doctest2
test_MimeWriter
test_SimpleHTTPServer
test_StringIO
test___all__
test___future__
test__locale
test__osx_support
test_abc
test_abstract_numbers
test_aepack
test_aepack skipped -- No module named aetypes
test_aifc
test_al
test_al skipped -- No module named al
test_anydbm
test_applesingle
test_applesingle skipped -- No module named MacOS
test_argparse
test_array
test_ascii_formatd
test_ast
test_asynchat

--
components: Tests
files: test_asynchat.txt
messages: 189340
nosy: Carlos.Nepomuceno
priority: normal
severity: normal
status: open
title: test_asynchat hangs
type: compile error
versions: Python 2.7
Added file: http://bugs.python.org/file30277/test_asynchat.txt

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



[issue17992] test_asynchat hangs

2013-05-15 Thread Carlos Nepomuceno

Changes by Carlos Nepomuceno :


Removed file: http://bugs.python.org/file30278/test_asynchat.txt

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



[issue17992] test_asynchat hangs

2013-05-15 Thread Carlos Nepomuceno

Changes by Carlos Nepomuceno :


Removed file: http://bugs.python.org/file30277/test_asynchat.txt

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



[issue17992] test_asynchat hangs

2013-05-15 Thread Carlos Nepomuceno

Changes by Carlos Nepomuceno :


Added file: http://bugs.python.org/file30278/test_asynchat.txt

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



[issue17992] test_asynchat hangs

2013-05-15 Thread Carlos Nepomuceno

Changes by Carlos Nepomuceno :


Added file: http://bugs.python.org/file30279/test_asynchat.txt

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



[issue17992] test_asynchat hangs

2013-05-16 Thread Carlos Nepomuceno

Carlos Nepomuceno added the comment:

I don't know what to do. I tried CTRL+C but it didn't stop. Then I pressed 
CTRL+Z and kill the python process and when i got back with 'fg' the make 
process had been terminated. No messages were printed.

--

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



[issue17992] test_asynchat hangs

2013-05-16 Thread Carlos Nepomuceno

Carlos Nepomuceno added the comment:

./python -m trace -t Lib/test/test_asynchat.py
[...] 
 --- modulename: asyncore, funcname: poll
asyncore.py(126): if map is None:
asyncore.py(128): if map:
asyncore.py(129): r = []; w = []; e = []
asyncore.py(130): for fd, obj in map.items():
asyncore.py(131): is_r = obj.readable()
 --- modulename: asynchat, funcname: readable
asynchat.py(198): return 1
asyncore.py(132): is_w = obj.writable()
 --- modulename: asynchat, funcname: writable
asynchat.py(202): return self.producer_fifo or (not self.connected)
asyncore.py(133): if is_r:
asyncore.py(134): r.append(fd)
asyncore.py(136): if is_w and not obj.accepting:
asyncore.py(137): w.append(fd)
asyncore.py(138): if is_r or is_w:
asyncore.py(139): e.append(fd)
asyncore.py(130): for fd, obj in map.items():
asyncore.py(140): if [] == r == w == e:
asyncore.py(144): try:
asyncore.py(145): r, w, e = select.select(r, w, e, timeout)
asyncore.py(152): for fd in r:
asyncore.py(158): for fd in w:
asyncore.py(164): for fd in e:
asyncore.py(221): count = count - 1
asyncore.py(219): while map and count > 0:
test_asynchat.py(225): s.start_resend_event.set()
 --- modulename: threading, funcname: set
threading.py(580): self.__cond.acquire()
threading.py(581): try:
threading.py(582): self.__flag = True
threading.py(583): self.__cond.notify_all()
 --- modulename: threading, funcname: notifyAll
threading.py(406): self.notify(len(self.__waiters))
 --- modulename: threading, funcname: notify
threading.py(382): if not self._is_owned():
 --- modulename: threading, funcname: _is_owned
threading.py(302): if self.__lock.acquire(0):
threading.py(306): return True
threading.py(384): __waiters = self.__waiters
threading.py(385): waiters = __waiters[:n]
threading.py(386): if not waiters:
threading.py(388): self._note("%s.notify(): no waiters", self)
 --- modulename: threading, funcname: _note
threading.py(64): if self.__verbose:
threading.py(389): return
threading.py(585): self.__cond.release()
test_asynchat.py(226): s.join()
 --- modulename: threading, funcname: join
threading.py(933): if not self.__initialized:
threading.py(935): if not self.__started.is_set():
 --- modulename: threading, funcname: isSet
threading.py(569): return self.__flag
threading.py(937): if self is current_thread():
 --- modulename: threading, funcname: currentThread
threading.py(1157): try:
threading.py(1158): return _active[_get_ident()]
threading.py(941): if not self.__stopped:
threading.py(942): self._note("%s.join(): waiting until thread 
stops", self)
 --- modulename: threading, funcname: _note
threading.py(64): if self.__verbose:
threading.py(943): self.__block.acquire()
threading.py(944): try:
threading.py(945): if timeout is None:
threading.py(946): while not self.__stopped:
threading.py(947): self.__block.wait()
 --- modulename: threading, funcname: wait
threading.py(331): if not self._is_owned():
 --- modulename: threading, funcname: _is_owned
threading.py(302): if self.__lock.acquire(0):
threading.py(306): return True
threading.py(333): waiter = _allocate_lock()
threading.py(334): waiter.acquire()
threading.py(335): self.__waiters.append(waiter)
threading.py(336): saved_state = self._release_save()
 --- modulename: threading, funcname: _release_save
threading.py(294): self.__lock.release()   # No state to save
threading.py(337): try:# restore state no matter what (e.g., 
KeyboardInterrupt)
threading.py(338): if timeout is None:
threading.py(339): waiter.acquire()

--

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



[issue17992] test_asynchat hangs

2013-05-16 Thread Carlos Nepomuceno

Carlos Nepomuceno added the comment:

Thank you! But what's going on?

Do my system have any limitation that is causing such hang?

Here goes it's ulimit output just in case:

[root@localhost Python-2.7.5]# ulimit -a
core file size  (blocks, -c) 0
data seg size   (kbytes, -d) unlimited
scheduling priority (-e) 0
file size   (blocks, -f) unlimited
pending signals (-i) 31259
max locked memory   (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files  (-n) 1024
pipe size(512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority  (-r) 0
stack size  (kbytes, -s) 10240
cpu time   (seconds, -t) unlimited
max user processes  (-u) 31259
virtual memory  (kbytes, -v) unlimited
file locks  (-x) unlimited
[root@localhost Python-2.7.5]#

--

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



[issue17992] test_asynchat hangs

2013-05-16 Thread Carlos Nepomuceno

Carlos Nepomuceno added the comment:

Full output in the attached file.

[root@localhost Python-2.7.5]# strace -ttT -f ./python Lib/test/test_asynchat.py
[...]
[pid  1697] 08:01:27.815179 select(6, [5], [5], [5], {0, 1}) = 0 (Timeout) 
<0.010095>
[pid  1697] 08:01:27.825348 select(6, [5], [5], [5], {0, 1}) = 0 (Timeout) 
<0.010096>
[pid  1697] 08:01:27.835509 select(6, [5], [5], [5], {0, 1}) = 0 (Timeout) 
<0.010097>
[pid  1697] 08:01:27.845669 select(6, [5], [5], [5], {0, 1}) = 0 (Timeout) 
<0.010096>
[pid  1697] 08:01:27.855830 select(6, [5], [5], [5], {0, 1}) = 0 (Timeout) 
<0.010095>
[pid  1697] 08:01:27.866028 select(6, [5], [5], [5], {0, 1}) = 0 (Timeout) 
<0.010096>
[pid  1697] 08:01:27.876188 select(6, [5], [5], [5], {0, 1}) = 0 (Timeout) 
<0.010096>
[pid  1697] 08:01:27.886388 futex(0x1bb8280, FUTEX_WAIT_PRIVATE, 0, NULL


--
Added file: http://bugs.python.org/file30281/test_asynchat_strace.txt

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



[issue17992] test_asynchat hangs

2013-05-16 Thread Carlos Nepomuceno

Carlos Nepomuceno added the comment:

What ports are needed?

[root@localhost Python-2.7.5]# iptables -L
Chain INPUT (policy DROP)
target prot opt source   destination
ACCEPT udp  --  anywhere anywhereudp dpt:domain
ACCEPT tcp  --  anywhere anywheretcp dpt:http
ACCEPT tcp  --  anywhere anywheretcp dpt:https
ACCEPT icmp --  anywhere anywhereicmp echo-request
ACCEPT all  --  anywhere anywherestate 
RELATED,ESTABLISHED

Chain FORWARD (policy DROP)
target prot opt source   destination

Chain OUTPUT (policy ACCEPT)
target prot opt source   destination
ACCEPT all  --  anywhere anywherestate NEW
[root@localhost Python-2.7.5]#

--

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



[issue17992] test_asynchat hangs

2013-05-16 Thread Carlos Nepomuceno

Carlos Nepomuceno added the comment:

Yes, but I don't have the git clone.
Can you send the complete file instead of the patch?

--

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



[issue17992] test_asynchat hangs

2013-05-16 Thread Carlos Nepomuceno

Carlos Nepomuceno added the comment:

BTW, problem solved with:

iptables -A INPUT -d 127.0.0.1 -j ACCEPT
iptables -A INPUT -s 127.0.0.1 -j ACCEPT

Thanks a lot! \o

--

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



[issue17992] test_asynchat hangs

2013-05-16 Thread Carlos Nepomuceno

Carlos Nepomuceno added the comment:

Tried to use the new files[1] but they use 'support' instead of 'test_support' 
from 'test' module.

[1] test_asynchat.py, test_asyncore.py

--

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



[issue17992] test_asynchat hangs

2013-05-16 Thread Carlos Nepomuceno

Carlos Nepomuceno added the comment:

Ok! Thanks a lot!

--

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



[issue18031] The Python Tutorial says % string formatting will be removed

2013-05-21 Thread Carlos Nepomuceno

New submission from Carlos Nepomuceno:

It[1] says:
"Since str.format() is quite new, a lot of Python code still uses the % 
operator. However, because this old style of formatting will eventually be 
removed from the language, str.format() should generally be used."

[1] http://docs.python.org/2/tutorial/inputoutput.html#old-string-formatting

--
assignee: docs@python
components: Documentation
messages: 189791
nosy: Carlos.Nepomuceno, docs@python
priority: normal
severity: normal
status: open
title: The Python Tutorial says % string formatting will be removed
versions: Python 2.7

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



[issue18031] The Python Tutorial says % string formatting will be removed

2013-05-22 Thread Carlos Nepomuceno

Carlos Nepomuceno added the comment:

According to what I have been told at python-l...@python.org str.__mod__() is 
not going to be deprecated and that seems to be a myth created by Python's own 
documentation.

I do remember to have read previously in another page that it would be 
deprecated but that seems to be already corrected. Today I just found it in the 
tutorial.

--

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



[issue20215] Python2.7 socketserver can not listen IPv6 address

2014-11-19 Thread Carlos Ralli

Carlos Ralli added the comment:

Is it possible to use this patch for python2.7 ?

--
nosy: +Carlos.Ralli

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



[issue20215] Python2.7 socketserver can not listen IPv6 address

2014-11-19 Thread Carlos Ralli

Carlos Ralli added the comment:

Sorry, I've got nothing. Did you forget the attachment or mail body ?

2014-11-19 11:08 GMT+01:00 Berker Peksag :

>
> Changes by Berker Peksag :
>
>
> --
> nosy: +berker.peksag
> stage:  -> patch review
>
> ___
> Python tracker 
> <http://bugs.python.org/issue20215>
> ___
>

--

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



[issue23735] Readline not adjusting width after resize with 6.3

2015-03-21 Thread Carlos Pita

New submission from Carlos Pita:

See here:

https://github.com/ipython/ipython/issues/6974

Chet Ramey confirmed the bug is downstream:

As I recall from looking briefly at the ipython/python source code, it has
to do with python not handling the SIGWINCH and expecting readline to do
it even when readline is not active. In readline-6.3, readline only
installs its signal handlers when rl_callback_read_char is called, which
python does only when it receives a character and its select(2) call
returns. The way readline-6.2 and earlier did things, it could `steal'
signals from an application without being active. I think python doesn't
handle SIGWINCH at all, which means that it expects readline's signal
handler to be active all the time, instead of just when python calls back
into readline to have it read a character.

A possible fix would be to have python's readline module install a signal
handler for SIGWINCH and have it set readline's idea of the screen size.

--
messages: 238857
nosy: Carlos Pita
priority: normal
severity: normal
status: open
title: Readline not adjusting width after resize with 6.3

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



[issue23735] Readline not adjusting width after resize with 6.3

2015-03-21 Thread Carlos Pita

Carlos Pita added the comment:

Chet again:

Here's the story from the top.

Prior to readline-6.3, readline could `steal' signals from the calling
application in the sense that readline's signal handler got a crack at
all signals in which readline was interested before the application did.
Now, that was usually ok, since readline handled signals immediately
upon receipt and resent the signal to the calling application.  It did
all this in a signal handler context.

It's dangerous to execute `unsafe' library functions and system calls from
a signal handler. The Posix standard has a (short) list of signal-safe
functions.  Before bash-4.3/readline-6.3, readline and bash did far too
much work in signal handlers.  The most you are supposed to do in a signal
handler is set variables, preferably of type sig_atomic_t, and nothing
else.  The biggest offenders are malloc and free, for two reasons:
applications often want to provide their own memory allocation atop
malloc and free, and using them from signal handlers can interfere; and
the glibc versions use internal locks extensively, and calling, say, free
from a signal handler can end up in a deadlock.

I made some progress up to bash-4.2/readline-6.2 in deferring `real' work
until readline wasn't in a signal handling context using the
RL_CHECK_SIGNALS() macro, but there were still a few places left that
handled the signal immediately.  One of those places was the callback
handling code; another was the SIGWINCH handling.

The SIGWINCH code signal handling functions eventually generated the same
sort of bug reports as other signals.  One representative report is

http://lists.gnu.org/archive/html/bug-bash/2011-02/msg00291.html

The fix was to make SIGWINCH handling the same as other signals: set a
flag and defer handling until no longer in a signal handling context.
This was necessary in both `direct' and callback modes.

The gdb folks reported most of the problems with the callback code handling
signals immediately instead of deferring handling until out of a signal
handler context; one such report is

http://lists.gnu.org/archive/html/bug-readline/2011-07/msg00010.html

So now the SIGWINCH and the callback code had to be changed to avoid
unsafe function calls from within a signal handler.

That very quickly uncovered a problem: the issue of readline stealing
the application's signals became much worse.

http://lists.gnu.org/archive/html/bug-readline/2011-07/msg00012.html

is the first explanation of that phenomenon.  If readline's signal
handlers are called when the application is active (e.g., between the
calls to rl_callback_handler_install and rl_callback_read_char), and all
they do is set a private flag the application doesn't know about, the
signals will effectively be ignored until the next time the application
calls into the readline callback interface and readline can check signals.
This is not acceptable in most contexts, including for SIGWINCH.

The fix for that is to make readline's signal handlers be active only
when readline is active and can check the flag the handlers set.

And so we reach where we are.  If a SIGWINCH arrives while readline is
not active, and the application using callback mode does not catch it and
tell readline about the updated screen dimensions (rl_set_screen_size()
exists for this purpose), readline will not know about the new size.

It seems like the issue is that people assume that the pre-readline-6.3
behavior was acceptable because they never encountered a problem, and that
any change must therefore be a bug.

Please feel free to add this message to the python issue tracker.

--

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



[issue2236] Distutils' mkpath implementation ignoring the "mode" parameter

2010-09-14 Thread Carlos Henrique Romano

Carlos Henrique Romano  added the comment:

Patch updated, now it includes test.

--
nosy: +chromano
Added file: 
http://bugs.python.org/file18885/python-distutils_mkpath_filemode-v1.diff

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



[issue2236] Distutils' mkpath implementation ignoring the "mode" parameter

2010-09-14 Thread Carlos Henrique Romano

Changes by Carlos Henrique Romano :


Removed file: 
http://bugs.python.org/file18885/python-distutils_mkpath_filemode-v1.diff

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



[issue2236] Distutils' mkpath implementation ignoring the "mode" parameter

2010-09-14 Thread Carlos Henrique Romano

Carlos Henrique Romano  added the comment:

Improving tests

--
Added file: 
http://bugs.python.org/file18887/python-distutils_mkpath_filemode-v2.diff

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



[issue2236] Distutils' mkpath implementation ignoring the "mode" parameter

2010-09-18 Thread Carlos Henrique Romano

Carlos Henrique Romano  added the comment:

Updating test in order to consider umask, this is supposed to fix buildbot 
issues.

--
Added file: 
http://bugs.python.org/file18927/python-distutils_mkpath_filemode-test-update.diff

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



[issue4219] Problem with regular expression

2008-10-28 Thread Carlos Eduardo Klock

New submission from Carlos Eduardo Klock <[EMAIL PROTECTED]>:

Hello, 

I am having a weird problem with regex. I am trying to get the tokens
that match the pattern below, but it is not working only for a specific
case. I do this for many lines of text, and it works, except for the
string '1214578800'.

Any idea of what is happening? Is it a problem of my code or a bug in
regular expressions?

Thanks for any help,

Carlos.



import re
r =
re.compile(",'([0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9])'[,|)]")
text =
"('25','2','3','2','0','1','0','0/350','30','21','5','','1211641200','1214578800','0','2','1214662622');"
timestamps = r.findall(text)
print timestamps


OUTPUT:
Python 2.5.2 (r252:60911, Jul 31 2008, 17:31:22) 
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on Trabalho15, Standard
>>> ['1211641200', '1214662622']

--
components: Regular Expressions
messages: 75286
nosy: carlosklock
severity: normal
status: open
title: Problem with regular expression
type: behavior
versions: Python 2.5

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



[issue4219] Problem with regular expression

2008-10-28 Thread Carlos Eduardo Klock

Carlos Eduardo Klock <[EMAIL PROTECTED]> added the comment:

Sorry, it is really a problem with the comma.

Thanks for helping! :)

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



[issue39374] Key in sort -> Callable Object instead of function

2020-01-17 Thread Carlos Segura González

New submission from Carlos Segura González :

In the Documentation, the "Sorting HOW TO" 
(https://docs.python.org/3/howto/sorting.html) states that "have a key 
parameter to specify a function to be called". However, it might be other 
callable objects. In fact, some of the examples given in the documentation are 
not with functions.

I suggest: "have a key parameter to specify a callable object that is called..."

--
assignee: docs@python
components: Documentation
messages: 360219
nosy: Carlos Segura González, docs@python
priority: normal
severity: normal
status: open
title: Key in sort -> Callable Object instead of function
versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

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



[issue39374] Key in sort -> Callable Object instead of function

2020-01-17 Thread Carlos Segura González

Change by Carlos Segura González :


--
type:  -> enhancement

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



[issue39374] Key in sort -> Callable Object instead of function

2020-01-17 Thread Carlos Segura González

Carlos Segura González  added the comment:

The thing is that even in the "Language Reference" is not correct. In 
"https://docs.python.org/3/library/functions.html#sorted"; it is stated "key 
specifies a function of one argument that is used to extract a comparison 
key..."

I think that it is better to use the term callable object. In the case of the 
HOW-TO, maybe it would be good to clarify that a function is an example of a 
callable object or include a reference or something like that.

--

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



[issue42411] respect cgroups limits when trying to allocate memory

2020-12-03 Thread Carlos Alexandro Becker


Carlos Alexandro Becker  added the comment:

Any updates?

--

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



[issue42411] respect cgroups limits when trying to allocate memory

2020-11-19 Thread Carlos Alexandro Becker


New submission from Carlos Alexandro Becker :

A common use case is running python inside containers, for instance, for 
training models and things like that.

The python process sees the host memory/cpu, and ignores its limits, which 
often leads to OOMKills, for instance:

docker run -m 1G --cpus 1 python:rc-alpine python -c 'x = bytearray(80 * 1024 * 
1024 * 1000)'


Linux will kill the process once it reaches 1GB of RAM used.

Ideally, we should have an option to make Python try to allocate only the ram 
its limited to, maybe something similar to Java's +X:UseContainerSupport.

--
components: IO
messages: 381442
nosy: caarlos0
priority: normal
severity: normal
status: open
title: respect cgroups limits when trying to allocate memory
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9

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



[issue42411] respect cgroups limits when trying to allocate memory

2020-11-20 Thread Carlos Alexandro Becker


Carlos Alexandro Becker  added the comment:

The problem is that, instead of getting a MemoryError, Python tries to "go out 
of bounds" and allocate more memory than the cgroup allows, causing Linux to 
kill the process.

A workaround is to set RLIMIT_AS to the contents of 
/sys/fs/cgroup/memory/memory.limit_in_bytes, which is more or less what Java 
does when that flag is enabled (there are more things: cgroups v2 has a 
different path I think).

Setting RLIMIT_AS, we get the MemoryError as expected, instead of a SIGKILL.

My proposal is to either make it the default or hide it behind some sort of 
flag/environment variable, so users don't need to do that everywhere...

PS: On java, that flag also causes its OS API to return the limits when asked 
for how much memory is available, instead of returning the host's memory 
(default behavior).

PS: I'm not an avid Python user, just an ops guy, so I mostly write yaml these 
days... please let me know if I said doesn't make sense. 

Thanks!

--

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



[issue42411] respect cgroups limits when trying to allocate memory

2020-11-20 Thread Carlos Alexandro Becker


Carlos Alexandro Becker  added the comment:

Maybe you're trying to allocate more memory than the host has available? I 
found out that it gives MemoryError in those cases too (kind of easy to 
reproduce on docker for mac)...

--

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



[issue42411] respect cgroups limits when trying to allocate memory

2020-11-20 Thread Carlos Alexandro Becker

Carlos Alexandro Becker  added the comment:

FWIW, here, both cases:

```
❯ docker ps -a
CONTAINER IDIMAGE   COMMAND  CREATED
  STATUSPORTS   NAMES
30fc350a8dbdpython:rc-alpine"python -c 'x = byte…"   24 seconds ago 
  Exited (137) 11 seconds ago   great_murdock
5ba46a022910fedora:33   "python3 -c 'x = byt…"   57 seconds ago 
  Exited (137) 43 seconds ago   boring_edison
```

--

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



[issue42411] respect cgroups limits when trying to allocate memory

2020-11-20 Thread Carlos Alexandro Becker


Carlos Alexandro Becker  added the comment:

Just did more tests here:

**on my machine**:

$ docker run --name test -m 1GB fedora:33 python3 -c 'import resource; m = 
int(open("/sys/fs/cgroup/memory/memory.limit_in_bytes").read()); 
resource.setrlimit(resource.RLIMIT_AS, (m, m)); 
print(resource.getrlimit(resource.RLIMIT_AS)); x = bytearray(4 * 1024 * 1024 * 
1000)'; docker inspect test | grep OOMKilled; docker rm test
Traceback (most recent call last):
  File "", line 1, in 
MemoryError
(1073741824, 1073741824)
"OOMKilled": false,
test

$ docker run --name test -m 1GB fedora:33 python3 -c 'x = bytearray(4 * 1024 * 
1024 * 1000)'; docker inspect test | grep OOMKilled; docker rm test
"OOMKilled": true,
test

**on a k8s cluster**:

$ kubectl run -i -t debug --rm --image=fedora:33 --restart=Never 
--limits='memory=1Gi'
If you don't see a command prompt, try pressing enter.
[root@debug /]# python3
Python 3.9.0 (default, Oct  6 2020, 00:00:00)
[GCC 10.2.1 20200826 (Red Hat 10.2.1-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> x = bytearray(4 * 1024 * 1024 * 1000)
Killed
[root@debug /]# python3
Python 3.9.0 (default, Oct  6 2020, 00:00:00)
[GCC 10.2.1 20200826 (Red Hat 10.2.1-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import resource
>>> m = int(open("/sys/fs/cgroup/memory/memory.limit_in_bytes").read())
>>> resource.setrlimit(resource.RLIMIT_AS, (m, m))
>>> print(resource.getrlimit(resource.RLIMIT_AS))
(1073741824, 1073741824)
>>> x = bytearray(4 * 1024 * 1024 * 1000)
Traceback (most recent call last):
  File "", line 1, in 
MemoryError
>>>

--

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



[issue2441] Mac build_install.py script fetches unavailable SQLite version

2008-03-20 Thread Carlos Eduardo de Paula

New submission from Carlos Eduardo de Paula <[EMAIL PROTECTED]>:

The build_installer.py script, used to create MacPython installers tries 
to fetch a SQLite version that is not available anymore. I provided a 
patch with an updated version and its corresponding hash.

Maybe this should be backported to 2.5 and 2.6 branches.

--
components: Installation
files: build_installer.diff
keywords: patch
messages: 64218
nosy: carlosedp
severity: normal
status: open
title: Mac build_install.py script fetches unavailable SQLite version
type: behavior
versions: Python 3.0
Added file: http://bugs.python.org/file9796/build_installer.diff

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



[issue22417] PEP 476: verify HTTPS certificates by default

2017-01-03 Thread Carlos Alberto Lopez Perez

Carlos Alberto Lopez Perez added the comment:

The python 2.7 documentation for urrlib still has a big warning notice at the 
top saying:

"""
Warning

When opening HTTPS URLs, it does not attempt to validate the server 
certificate. Use at your own risk! 
"""
^^ https://docs.python.org/2/library/urllib.html

I believe this is incorrect since this patch was backported to the 2.7  branch. 
I checked it, and it verifies SSL certs by default.


I guess the documentation for urllib should be updated to remove that warning?

--
nosy: +clopez

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



[issue28336] Slicing (operation) is not symmetrical with respect to suffixes and prefixes

2016-10-01 Thread Juan Carlos Pujol Mainegra

New submission from Juan Carlos Pujol Mainegra:

Let s be a string or other array-like object, a, b > 0 integers, s[0:b] returns 
a b-long prefix to s, the same as s[:b], but s[-a:0] returns empty (for len(s) 
> 0 and a > 1), while it should return the same as s[-a:], an a-long suffix (a 
> 0).

A syntax asymmetry like this shall not be imposed to those using non-literal 
slicing indexes, as it would be necessarily to introduce a control condition to 
test whether the upper bound index is a non-negative quantity, assuming the 
lower bound index is negative. Furthermore, it breaks the whole negative 
slicing idea, being that (I consider) index i always be treated as i mod 
len(s), so that constructions like s[-a:b] (for a, b > 0 or a, b < 0) could 
return s[-a:] + s[:b].

--
components: Interpreter Core
messages: 277829
nosy: jksware
priority: normal
severity: normal
status: open
title: Slicing (operation) is not symmetrical with respect to suffixes and 
prefixes
type: enhancement
versions: Python 3.6

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



[issue37176] super() docs don't say what super() does

2019-06-12 Thread Carlos André Dantas de Lima

Carlos André Dantas de Lima  added the comment:

The method says who you will use some recursion.

--
nosy: +Carlos André Dantas de Lima

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