[issue33166] os.cpu_count() returns wrong number of processors on specific systems

2018-03-28 Thread Giampaolo Rodola'
Giampaolo Rodola' <g.rod...@gmail.com> added the comment: Oh! So both os.cpu_count() and psutil.cpu_count() are wrong? How do you determine the actual number of logical/physical CPUs on your machine? -- ___ Python tracker <rep...@bugs.p

[issue33166] os.cpu_count() returns wrong number of processors on specific systems

2018-03-28 Thread Giampaolo Rodola'
Giampaolo Rodola' <g.rod...@gmail.com> added the comment: The difference between os.cpu_count() and psutil.cpu_count() is because one uses GetMaximumProcessorCount() and the other dwNumberOfProcessors. This is tracked as a bug in psutil bug tracker but it's not fixed yet: https://gith

[issue33122] ftplib: FTP_TLS seems to have problems with sites that close the encrypted channel themselfes

2018-03-23 Thread Giampaolo Rodola'
Giampaolo Rodola' <g.rod...@gmail.com> added the comment: Please paste your code and traceback message. Also what's the remote FTP server you're connected to? You should be able to see it in the welcome message (you can set FTP_TLS.debugging t

[issue32572] Add the ftplib option, overrides the IP address.

2018-02-01 Thread Giampaolo Rodola'
Giampaolo Rodola' <g.rod...@gmail.com> added the comment: Considering the security implications and the fact that it's a corner case I don't think this is worth adding as a new, public API, sorry. I think ftplib should expose and promote APIs reflecting common scenarios and good pra

[issue32572] Add the ftplib option, overrides the IP address.

2018-02-01 Thread Giampaolo Rodola'
Giampaolo Rodola' <g.rod...@gmail.com> added the comment: Mmmm out of curiosity, how common is this? Usually when client is behind a NAT it's supposed to use PASV. What you're proposing is a configuration option which typically belong to servers, not clients. I don't remember ever b

[issue32410] Implement loop.sock_sendfile method

2018-01-19 Thread Giampaolo Rodola'
Change by Giampaolo Rodola' <g.rod...@gmail.com>: -- nosy: +giampaolo.rodola ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

[issue30579] Allow traceback objects to be instantiated/mutated/annotated

2017-12-11 Thread Giampaolo Rodola'
Change by Giampaolo Rodola' <g.rod...@gmail.com>: -- nosy: -giampaolo.rodola ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

[issue31970] asyncio debug mode is very slow

2017-11-08 Thread Giampaolo Rodola'
Giampaolo Rodola' <g.rod...@gmail.com> added the comment: Sorry. It looks like I completely misunderstood. =) -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

[issue31970] asyncio debug mode is very slow

2017-11-08 Thread Giampaolo Rodola'
Giampaolo Rodola' <g.rod...@gmail.com> added the comment: >> I've a few ideas how to add 0-copy support to protocols. > I'd be interesting to hear about them. The main challenge IMHO is to find a > way to allow a readinto()-like functionality. Exposing sendfile() should be

[issue31610] Use select.poll instead of select.select in SocketServer.BaseServer.serve_forever

2017-09-28 Thread Giampaolo Rodola'
Giampaolo Rodola' <g.rod...@gmail.com> added the comment: I recommend to use selectors.PollSelector and fallback on selectors.SelectSelector where not available (Windows) in order to use 1 syscall only. That's what we did already in socket.py, subprocess.py and others. -

[issue23530] os and multiprocessing.cpu_count do not respect cpuset/affinity

2017-09-05 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <g.rod...@gmail.com>: -- nosy: +giampaolo.rodola ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue26692] cgroups support in multiprocessing

2017-09-04 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <g.rod...@gmail.com>: -- nosy: +giampaolo.rodola ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue30581] os.cpu_count() returns wrong number of processors on system with > 64 logical processors

2017-07-29 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: I agree that the MS Docs for this are a bit confusing. I ended up reaching out to the guy who authored the GetMaximumProcessorCount function. I had also written an implementation that iterated over GetProcessorInformationEx and he advised against it. One

[issue30581] os.cpu_count() returns wrong number of processors on system with > 64 logical processors

2017-07-29 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: About GetMaximumProcessorCount, MS doc states that it returns the "maximum number of logical processors that a processor group or the system can have", so maybe it also includes "empty" CPU sockets. GetActiveProcessorCount, on the

[issue30581] os.cpu_count() returns wrong number of processors on system with > 64 logical processors

2017-07-29 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: MS documentation is not clear on what function should be used as there are many returning different values. Here it is being suggested to use GetLogicalProcessorInformationEx: https://stackoverflow.com/questions/31209256/reliable-way-to-programmatically

[issue30931] Race condition in asyncore may access the wrong dispatcher

2017-07-29 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <g.rod...@gmail.com>: -- assignee: -> giampaolo.rodola ___ Python tracker <rep...@bugs.python.org> <http://bugs.pyt

[issue30931] Race condition in asyncore may access the wrong dispatcher

2017-07-29 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: +1, I would push https://github.com/python/cpython/pull/2854/ first and fix the race condition only. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue29214] Standard open() does not allow to specify file permissions.

2017-07-26 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <g.rod...@gmail.com>: -- nosy: +giampaolo.rodola ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue29256] Windows select() errors out when given no fds to select on, which breaks SelectSelector

2017-07-26 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <g.rod...@gmail.com>: -- nosy: +giampaolo.rodola ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue30119] (ftplib) A remote attacker could possibly attack by containing the newline characters

2017-07-26 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: AFAIK its only use case is to escape \r and \n. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue30119] (ftplib) A remote attacker could possibly attack by containing the newline characters

2017-07-26 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: > What about rejecting also NUL byte? I don't it would make any difference at this point. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.or

[issue30985] Set closing variable in asyncore at close

2017-07-25 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: I would probably feel safer to use "__closed" for all python versions and adopt the same naming convention for any attribute we may want to add in the future. Kinda weird, but asyncore is probably the only case of deprecated module with bad

[issue30985] Set closing variable in asyncore at close

2017-07-25 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: On the other hand, due to the poor asyncore API, I think it's safer if we land this in 3.7 only. "closing" attribute was never documented so if there's code out there setting it to True that'll crash their app pretty quickly as sockets w

[issue30985] Set closing variable in asyncore at close

2017-07-25 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: I welcome this change as it avoids tricks like this one: https://github.com/giampaolo/pyftpdlib/blob/1268bb185cd63c657d78bc33309041628e62360a/pyftpdlib/handlers.py#L537 Any app using asyncore for anything other than an echo server eventually ends up doing

[issue30931] Race condition in asyncore may access the wrong dispatcher

2017-07-25 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: > Yes, this is a typical issue in asyncore if you don't protect your > subclass to handle double close. I use the same trick all over the place in pyftpdlib: https://github.com/giampaolo/pyftpdlib/blob/1268bb185cd63c657d78bc33309041628e62360a/pyf

[issue30119] (ftplib) A remote attacker could possibly attack by containing the newline characters

2017-07-25 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: Reopening as it needs backports for 2.7, 3.3, 3.4, 3.5 and 3.6. -- resolution: duplicate -> stage: resolved -> backport needed status: closed -> pending versions: +Python 2.7, Python 3.3, Python 3.4, Python 3.5, P

[issue30190] unittest's assertAlmostEqual improved error message

2017-07-25 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: Sorry, I accidentally picked up the wrong thread. -- resolution: -> fixed stage: backport needed -> resolved status: pending -> closed versions: -Python 2.7, Python 3.3, Python 3.4, Python 3.5, P

[issue30190] unittest's assertAlmostEqual improved error message

2017-07-25 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: Reopening as it needs backports for 2.7, 3.3, 3.4, 3.5 and 3.6. -- resolution: fixed -> stage: resolved -> backport needed status: closed -> pending versions: +Python 2.7, Python 3.3, Python 3.4, Python 3.5, P

[issue30119] (ftplib) A remote attacker could possibly attack by containing the newline characters

2017-07-22 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: New changeset 2b1e6e9696cb433c0e0da11145157d54275d119f by Giampaolo Rodola (Dong-hee Na) in branch 'master': bpo-30119: fix ftplib.FTP.putline() to throw an error for a illegal command (#1214) https://github.com/python/cpython/commit

[issue28638] Optimize namedtuple creation

2017-07-19 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: > While "40x faster" is more 10x faster than "4x faster", C > implementation can boost only CPython and makes maintenance more harder. As a counter argument against "let's not do it because it'll be harder to maintain" I

[issue28638] Optimize namedtuple creation

2017-07-18 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: > Should we consider a C-based implementation like > https://github.com/ll/cnamedtuple? > It could improve speed even more, but would be harder to maintain and > test and harder to keep compatible. My sense is that it's not worth

[issue28638] Optimize namedtuple creation

2017-07-17 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <g.rod...@gmail.com>: -- nosy: +giampaolo.rodola ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue19640] Dynamically generate the _source attribute of namedtuple to save memory)

2017-07-17 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <g.rod...@gmail.com>: -- nosy: +giampaolo.rodola ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue28287] Refactor subprocess.Popen to let a subclass handle IO asynchronously

2017-07-14 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: Is the main goal to just make Popen.__init__ non-blocking? If not, #1191964 aims at providing non-blocking reads/writes (including on Windows). -- nosy: +giampaolo.rodola ___ Python tracker <

[issue30624] selectors should use bare except clauses

2017-06-12 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: I see that on 3.6 except BaseException: is used, so the backport should not be necessary. -- resolution: -> fixed stage: backport needed -> resolved status: open -> closed versions: -Python 3.5, P

[issue30624] selectors should use bare except clauses

2017-06-12 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: New changeset ced36a993fcfd1c76637119d31c03156a8772e11 by Giampaolo Rodola in branch 'master': bpo-30624 remaining bare except (#2108) https://github.com/python/cpython/commit/ced36a993fcfd1c76637119d31c03156a8772e11

[issue30624] selectors should use bare except clauses

2017-06-11 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: > But only 2 of 3 "except Exception" are fixed. My bad. New PR: https://github.com/python/cpython/pull/2108 -- ___ Python tracker <rep...@bugs.python.org> <http://bugs

[issue30624] selectors should use bare except clauses

2017-06-11 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <g.rod...@gmail.com>: -- pull_requests: +2161 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30624> ___

[issue30624] selectors should use bare except clauses

2017-06-10 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <g.rod...@gmail.com>: -- pull_requests: +2146 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30624> ___

[issue30624] selectors should use bare except clauses

2017-06-10 Thread Giampaolo Rodola'
New submission from Giampaolo Rodola': Right now it uses "except Exception: ...; raise" which does not take KeyboardInterrupt and SystemExit into account, leaving the fd in a bad state (it's not unregister()ed). -- components: asyncio messages: 295648 nosy: ber

[issue30581] os.cpu_count() returns wrong number of processors on system with > 64 logical processors

2017-06-07 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: Nobody has AFAIK. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30581> ___ ___ Python-bugs-

[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-06-07 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: OK, https://github.com/python/cpython/pull/1030 should be good to go. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue30581] os.cpu_count() returns wrong number of processors on system with > 64 logical processors

2017-06-06 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <g.rod...@gmail.com>: -- nosy: +giampaolo.rodola ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue30190] unittest's assertAlmostEqual improved error message

2017-05-10 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <g.rod...@gmail.com>: -- status: open -> closed ___ Python tracker <rep...@bugs.python.org> <http://bugs.pyt

[issue30190] unittest's assertAlmostEqual improved error message

2017-05-10 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <g.rod...@gmail.com>: -- pull_requests: +1633 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30190> ___

[issue30190] unittest's assertAlmostEqual improved error message

2017-05-10 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: OK thanks. Fix coming. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30190> ___ ___ Pyth

[issue30190] unittest's assertAlmostEqual improved error message

2017-05-10 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: Mmm I can't see them. Am I supposed to enable this kind of warning somehow? -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue30295] msvcrt SetErrorMode not documented

2017-05-07 Thread Giampaolo Rodola'
New submission from Giampaolo Rodola': Also SEM_FAILCRITICALERRORS and other SEM_constants. They should as setting error mode on Windows for console applications is a pretty common use case (in fact ./Lib/test/libregrtest/setup.py uses it). -- assignee: docs@python components

[issue30286] ctypes FreeLibrary fails on Windows 64-bit

2017-05-07 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: > It's documented that the default conversion for integer arguments is a 32-bit > C int. [...] Whenever a pointer is returned, you must set the function's > restype. OK, clear. Closing this out. -- resolution: -> not a bug stage:

[issue30286] ctypes FreeLibrary fails on Windows 64-bit

2017-05-05 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: http://stackoverflow.com/questions/23522055/error-when-unload-a-64bit-dll-using-ctypes-windll Adding "ctypes.windll.kernel32.FreeLibrary.argtypes = [wintypes.HMODULE]" fixes the issue. This works: import ctypes from ctypes import wintypes

[issue30286] ctypes FreeLibrary fails on Windows 64-bit

2017-05-05 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <g.rod...@gmail.com>: -- nosy: +amaury.forgeotdarc, belopolsky, meador.inge, theller ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue30286] ctypes FreeLibrary fails on Windows 64-bit

2017-05-05 Thread Giampaolo Rodola'
New submission from Giampaolo Rodola': >>> import ctypes >>> path = 'C:\\Python35-64\\vcruntime140.dll' >>> cfile = ctypes.CDLL(path) >>> cfile._handle 140736170229760 >>> ctypes.windll.kernel32.FreeLibrary(cfile._handle) Traceback (most recent call

[issue30205] socket.getsockname() type mismatch with AF_UNIX on Linux

2017-05-02 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: Thanks. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30205> ___ ___ Python-bugs-list

[issue30119] (ftplib) A remote attacker could possibly attack by containing the newline characters

2017-05-01 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: The relevant discussion of this bug is happening in https://github.com/python/cpython/pull/1214. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue30190] unittest's assertAlmostEqual improved error message

2017-05-01 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: New changeset 5d7a8d0c13737fd531b722ad76c505ef47aac96a by Giampaolo Rodola in branch 'master': bpo-30190: improved error msg for assertAlmostEqual(delta=...) (#1331) https://github.com/python/cpython/commit/5d7a8d0c13737fd531b722ad76c505ef47aac96a

[issue30204] socket.setblocking(0) changes socket.type

2017-04-29 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: Woo! I completely forgot I already bumped into this and that I even filed a ticket for it. -- resolution: -> duplicate stage: -> resolved status: open -> closed ___ Python tracker <rep...@bugs.pytho

[issue30205] socket.getsockname() type mismatch with AF_UNIX on Linux

2017-04-29 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: The change was introduced here: https://github.com/python/cpython/commit/b10c71daa2099c450101e5854fd693a405bec49c -- nosy: +neologix versions: +Python 2.7 ___ Python tracker <rep...@bugs.python.org>

[issue30205] socket.getsockname() type mismatch with AF_UNIX on Linux

2017-04-29 Thread Giampaolo Rodola'
New submission from Giampaolo Rodola': >>> import socket >>> s = socket.socket(socket.AF_UNIX) >>> s.getsockname() b'' >>> s.bind('foo') >>> s.getsockname() 'foo' -- messages: 292580 nosy: giampaolo.rodola priority: normal severity: normal

[issue30204] socket.setblocking(0) changes socket.type

2017-04-29 Thread Giampaolo Rodola'
New submission from Giampaolo Rodola': This caused me a lot of headaches (broken test) before figuring out what the heck was wrong: =) >>> import socket >>> s = socket.socket() >>> s.type >>> s.setblocking(0) >>> s.type 2049 >>> s.setblo

[issue29606] urllib FTP protocol stream injection

2017-04-28 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <g.rod...@gmail.com>: -- nosy: +giampaolo.rodola ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue30119] (ftplib) A remote attacker could possibly attack by containing the newline characters

2017-04-28 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <g.rod...@gmail.com>: -- nosy: +giampaolo.rodola ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue30190] unittest's assertAlmostEqual improved error message

2017-04-28 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: Done. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30190> ___ ___ Python-bugs-list

[issue30190] unittest's assertAlmostEqual improved error message

2017-04-28 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: Thanks for chiming in. > Is it worth to output a difference when the delta argument is not passed? Yes, probably. I will change that. > Is it worth to output a signed difference rather than an absolute value? Mmmm probably not IMHO. Personally I

[issue30190] unittest's assertAlmostEqual improved error message

2017-04-27 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <g.rod...@gmail.com>: -- title: unittest's assertAlmostEqual should show the difference -> unittest's assertAlmostEqual improved error message ___ Python tracker <rep...@bugs.python.org> <http

[issue30190] unittest's assertAlmostEqual should show the difference

2017-04-27 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: PR: https://github.com/python/cpython/pull/1331/ -- stage: needs patch -> patch review ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.or

[issue30190] unittest's assertAlmostEqual should show the difference

2017-04-27 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <g.rod...@gmail.com>: -- pull_requests: +1439 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30190> ___

[issue30190] unittest's assertAlmostEqual should show the difference

2017-04-27 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <g.rod...@gmail.com>: -- nosy: +ezio.melotti, michael.foord, rbcollins ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue30190] unittest's assertAlmostEqual should show the difference

2017-04-27 Thread Giampaolo Rodola'
New submission from Giampaolo Rodola': When comparing 2 numbers as "self.assertAlmostEqual(a, b, delta=1000)" the error message looks like this: AssertionError: 27332885 != 27391120 within 1000 delta Especially when a and b are big numbers or differ a lot, it would be usef

[issue9285] Add a profile decorator to profile and cProfile

2017-04-22 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: Original patch still applies. Not sure if we should continue with that one or with your new PR. The original assertion error is still there. I CCed Tim Peters as it appears he's the one who originally added it in 2001 - maybe he has some clue

[issue26860] Make os.walk and os.fwalk yield namedtuple instead of tuple

2017-04-08 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: Should we have concerns about performances? Accessing a namedtuple value is almost 4x times slower compared to a plain tuple [1] and os.walk() may iterate hundreds of times. http://stackoverflow.com/questions/2646157/what-is-the-fastest-to-access-struct

[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-08 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: For the sake of experiment I'm attaching a toy echo server which uses modify() to switch between EVENT_READ and EVENT_WRITE. Without patch I get 35000 req/sec, with patch around 39000 req/sec (11.4% faster). To be entirely honest a smarter echo server would

[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-08 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <g.rod...@gmail.com>: Added file: http://bugs.python.org/file46793/echo_client.py ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: @neologix: here's a PR which refactors the poll-related classes: https://github.com/python/cpython/pull/1035/files >From there, we'll be able to avoid modify() code duplication. -- ___ Python tracker &

[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: In certain protocols modify() is supposed to be used on every interaction between client and server. E.g. an FTP server does this: - register(fd, EVENT_READ); recv() # wait command from client - modify(fd, EVENT_WRITE); send(response) # send

[issue30014] Speedup DefaultSelectors.modify() by 1.5x

2017-04-07 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: > The idea is to reuse _BaseSelectorImpl.register() and > _BaseSelectorImpl.unregister() to factorize the code. You can't factorize the logic of modify() into those as they do two different things. I also don't like repeating the same thing 3

[issue30014] Speedup DefaultSelectors.modify() by 1.5x

2017-04-07 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: > My patch calls generic unregister() and register() of the base > classes, but it only uses one syscall per modify() call. Doesn't that mean doing 3 operations (unregister(), register(), modify()) instead of the current 2 (unregister(), register

[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: PR: https://github.com/python/cpython/pull/1030 -- pull_requests: +1187 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: Hey Stinner, thanks for chiming in! Your old patch uses unregister() and register() so I'm not sure what speedup that'll take as the whole point is to avoid doing that. You may want to rewrite it and benchmark it but it looks like it'll be slower

[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: modify() can be used often in verbose protocols such as FTP and SMTP where a lot of requests and responses are continuously exchanged between client and server, so you need to switch from EVENT_READ to EVENT_WRITE all the time. I did a similar change some

[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <g.rod...@gmail.com>: -- components: +Library (Lib), asyncio stage: -> patch review type: -> performance ___ Python tracker <rep...@bugs.python.org> <http://bugs.

[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <g.rod...@gmail.com>: -- nosy: +gvanrossum, haypo, neologix, yselivanov ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <g.rod...@gmail.com>: -- versions: +Python 3.7 Added file: http://bugs.python.org/file46788/bench.py ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread Giampaolo Rodola'
New submission from Giampaolo Rodola': Patch in attachment modifies DefaultSelector.modify() so that it uses the underlying selector's modify() method instead of unregister() and register() resulting in a 2x speedup. Without patch: ~/svn/cpython {master}$ ./python bench.py

[issue9285] Add a profile decorator to profile and cProfile

2017-02-24 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: The original patch is basically blocked by the cryptic assertion error reported above. It's not clear what it means or how to work around it. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.p

[issue28931] urllib ignores FTP 226 response, breaking further FTP requests

2016-12-14 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: I can't reproduce the issue on Python 3.5 (but I can on 2.7). -- nosy: +giampaolo.rodola versions: -Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 ___ Python tracker <rep...@bugs.python.org>

[issue25458] ftplib: command response shift - mismatch

2016-12-14 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: Maybe it's me but I still fail to understand what's the issue here. From what I understand from the last message(s) it seems there is complaint about not being able to use ftplib with threads. FTP is a "command - response" protocol which i

[issue28963] Use-after-free in _asyncio_Future_remove_done_callback() of _asynciomodule.c

2016-12-14 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <g.rod...@gmail.com>: -- nosy: -giampaolo.rodola ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue17038] multiprocessing only use one core when C module are imported

2016-11-28 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: Ended up here by accident. For whoever bumps into this same issue, psutil allows to get an set CPU affinity, so you can avoid using taskset. >>> import psutil >>> psutil.cpu_count() 4 >>> p = psutil.Process() >>>

[issue10049] Add a "no-op" (null) context manager to contextlib

2016-11-18 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: ExitStack() already covers the "null ctx mgr" use case described in the first message. Original example: with transaction or contextlib.null(): ... By using ExitStack: with transaction or ExitStack(): ... You can push this furt

[issue28684] [asyncio] bind() on a unix socket raises PermissionError on Android for a non-root user

2016-11-17 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <g.rod...@gmail.com>: -- nosy: -giampaolo.rodola ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue25008] Deprecate smtpd (based on deprecated asyncore/asynchat): write a new smtp server with asyncio

2016-11-17 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <g.rod...@gmail.com>: -- nosy: +giampaolo.rodola ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue25002] Deprecate asyncore/asynchat

2016-11-17 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <g.rod...@gmail.com>: -- nosy: +giampaolo.rodola ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue5309] distutils doesn't parallelize extension module compilation

2016-09-17 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: I have 2 complaints about this: 1 - doc is missing: the only way to be aware of this is either by reading the 3.6 what's new doc or by checking the cmdline helper 2 - -j "N" parameter could be optional: if not specified os.cpu_count() ca

[issue27876] Add SSLContext.set_version_range(minver, maxver=None)

2016-09-15 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <g.rod...@gmail.com>: -- nosy: -giampaolo.rodola ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue27768] ssl: get CPU cap flags for AESNI and PCLMULQDQ

2016-09-15 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <g.rod...@gmail.com>: -- nosy: -giampaolo.rodola ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue15670] PEP 3121, 384 Refactoring applied to ssl module

2016-09-15 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <g.rod...@gmail.com>: -- nosy: -giampaolo.rodola ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue23588] Errno conflicts in ssl.SSLError

2016-09-08 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <g.rod...@gmail.com>: -- nosy: -giampaolo.rodola ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue23843] ssl.wrap_socket doesn't handle virtual TLS hosts

2016-09-08 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <g.rod...@gmail.com>: -- nosy: -giampaolo.rodola ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue26081] Implement asyncio Future in C to improve performance

2016-07-03 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <g.rod...@gmail.com>: -- nosy: +giampaolo.rodola ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue26526] In parsermodule.c, replace over 2KLOC of hand-crafted validation code, with a DFA

2016-05-29 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' <g.rod...@gmail.com>: -- nosy: +giampaolo.rodola ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

<    1   2   3   4   5   6   7   8   9   10   >