[issue41111] Convert a few stdlib extensions to the limited C API

2020-06-28 Thread Gustavo J. A. M. Carneiro
Change by Gustavo J. A. M. Carneiro : -- nosy: +gustavo ___ Python tracker <https://bugs.python.org/issue4> ___ ___ Python-bugs-list mailing list Unsub

[issue32528] Change base class for futures.CancelledError

2018-09-24 Thread Gustavo J. A. M. Carneiro
Gustavo J. A. M. Carneiro added the comment: What a shame, I've seen this error many times as well. Surely making it BaseException will not break that much code?... -- nosy: +gustavo ___ Python tracker <https://bugs.python.org/issue32

[issue20519] Replace uuid ctypes usage with an extension module.

2015-10-28 Thread Gustavo J. A. M. Carneiro
Gustavo J. A. M. Carneiro added the comment: New patch that: 1. adds assert(sizeof(uuid_t) == 16); to the extension module; 2. fixes the code path when ctypes has to be used instead of the extension module (needed a bit more refactoring, apologies if it makes the diff harder to read); 3

[issue20519] Replace uuid ctypes usage with an extension module.

2015-10-26 Thread Gustavo J. A. M. Carneiro
Gustavo J. A. M. Carneiro added the comment: One issue of note is regarding generate_time(). Originally I found ctypes bindings for this function, so I wrapped it as well in the extension module. However, it doesn't appear to be used

[issue20519] Replace uuid ctypes usage with an extension module.

2015-10-26 Thread Gustavo J. A. M. Carneiro
Gustavo J. A. M. Carneiro added the comment: This patch fixes the Mac OS X issue @haypo pointed out. -- Added file: http://bugs.python.org/file40865/issue20519_10941v2.diff ___ Python tracker <rep...@bugs.python.org> <http://bugs.p

[issue23812] asyncio.Queue.put_nowait(), followed get() task cancellation leads to item being lost

2015-08-07 Thread Gustavo J. A. M. Carneiro
Gustavo J. A. M. Carneiro added the comment: I am not using hg anymore, since asyncio migrated to git. Here's a github PR, does that help? https://github.com/python/asyncio/pull/260 -- ___ Python tracker rep...@bugs.python.org http

[issue23812] asyncio.Queue.put_nowait(), followed get() task cancellation leads to item being lost

2015-08-07 Thread Gustavo J. A. M. Carneiro
Gustavo J. A. M. Carneiro added the comment: I was wrong, there still needs to be some cleanup in cancellation, even with the new approach. But it does solve the out-of-order problem. I don't know if it should be applied to rc1. I wish I had more time to test. Up to you guys

[issue23812] asyncio.Queue.put_nowait(), followed get() task cancellation leads to item being lost

2015-08-06 Thread Gustavo J. A. M. Carneiro
Gustavo J. A. M. Carneiro added the comment: I don't think the order for multiple concurrent getters matters that much. With analogy with the threading case, if multiple threads are blocked get()ing an item from the same queue, I would not presume to expect anything about the ordering which

[issue23812] asyncio.Queue.put_nowait(), followed get() task cancellation leads to item being lost

2015-08-06 Thread Gustavo J. A. M. Carneiro
Gustavo J. A. M. Carneiro added the comment: Sure, just give me a couple of days. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23812

[issue23812] asyncio.Queue.put_nowait(), followed get() task cancellation leads to item being lost

2015-07-15 Thread Gustavo J. A. M. Carneiro
Gustavo J. A. M. Carneiro added the comment: Don't know if it helps, but I made a github pull request for this: https://github.com/python/asyncio/pull/256 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23812

[issue23812] asyncio.Queue.put_nowait(), followed get() task cancellation leads to item being lost

2015-03-31 Thread Gustavo J. A. M. Carneiro
Gustavo J. A. M. Carneiro added the comment: So I uploaded a new patch version fixing a similar problem in put(). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23812

[issue23812] asyncio.Queue.put_nowait(), followed get() task cancellation leads to item being lost

2015-03-30 Thread Gustavo J. A. M. Carneiro
Changes by Gustavo J. A. M. Carneiro gjcarne...@gmail.com: Added file: http://bugs.python.org/file38741/Issue23812.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23812

[issue23812] asyncio.Queue.put_nowait(), followed get() task cancellation leads to item being lost

2015-03-30 Thread Gustavo J. A. M. Carneiro
New submission from Gustavo J. A. M. Carneiro: I have a pattern where I read from a queue with a timeout, generally like this: while True: reader = asyncio.async(wait_for(queue.get(), 0.1)) try: item = (yield from reader) except asyncio.TimeoutError: reader.cancel() continue

[issue23812] asyncio.Queue.put_nowait(), followed get() task cancellation leads to item being lost

2015-03-30 Thread Gustavo J. A. M. Carneiro
Gustavo J. A. M. Carneiro added the comment: - Are there other places where a cancellation can have a similar effect? Maybe the same logic in put()? Hm.. I didn't look, but yes, it does look like it might be affected by the same issue. I'll try to create a test for that to confirm. how

[issue23812] asyncio.Queue.put_nowait(), followed get() task cancellation leads to item being lost

2015-03-30 Thread Gustavo J. A. M. Carneiro
Gustavo J. A. M. Carneiro added the comment: I created a codereview issue: https://codereview.appspot.com/222930043 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23812

[issue20519] uuid.uuid4().hex generates garbage when ctypes available

2014-02-05 Thread Gustavo J. A. M. Carneiro
New submission from Gustavo J. A. M. Carneiro: If you try the attached program, you will find that for every iteration the uuid.uuid4() call generates objects that contain reference cycles and need the help of the garbage collector. This is not nice. If I make the ctypes module not able

[issue20519] uuid.uuid4().hex generates garbage when ctypes available

2014-02-05 Thread Gustavo J. A. M. Carneiro
Gustavo J. A. M. Carneiro added the comment: Well, this isn't a big problem, but I have an application that needs to run with the GC disabled, since it causes pauses of a couple of seconds each time a full collection runs (we have a few million objects allocated). I will run the GC only once

[issue20519] uuid.uuid4().hex generates garbage when ctypes available

2014-02-05 Thread Gustavo J. A. M. Carneiro
Gustavo J. A. M. Carneiro added the comment: I have narrowed it down to one line of code: ctypes.create_string_buffer(16) That is enough to create 7 objects that have reference cycles. [class 'ctypes.c_char_Array_16', {'__module__': 'ctypes', '__doc__': None, '__weakref__': attribute

[issue20519] ctypes.create_string_buffer creates reference cycles

2014-02-05 Thread Gustavo J. A. M. Carneiro
Gustavo J. A. M. Carneiro added the comment: Regardless, if you don't mind, take this patch for Python 3.5 to avoid ctypes, at least in the Linux case (I don't have Windows to test). Creating a proper extension module is safer and really not that hard... -- keywords: +patch Added

[issue975646] tp_(get|set)attro? inheritance bug

2009-02-14 Thread Gustavo J. A. M. Carneiro
Gustavo J. A. M. Carneiro gjcarne...@gmail.com added the comment: If this problem does not apply to Python 3.x, by all means go ahead and close it. It probably is a bug, but probably not worth fixing; workaround is simple enough, and affected extensions have already adapted

[issue2663] shutil.copytree glob-style filtering [patch]

2008-04-20 Thread Gustavo J. A. M. Carneiro
Changes by Gustavo J. A. M. Carneiro [EMAIL PROTECTED]: -- nosy: +gustavo __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2663 __ ___ Python-bugs-list mailing list

[issue1715] Make pydoc list submodules

2007-12-31 Thread Gustavo J. A. M. Carneiro
New submission from Gustavo J. A. M. Carneiro: Often python extension modules define submodules like this: static PyObject * initfoo_xpto(void) { PyObject *m; m = Py_InitModule3(foo.xpto, foo_xpto_functions, NULL); [...] return m; } PyMODINIT_FUNC initfoo(void) { PyObject

[issue1583] Patch for signal.set_wakeup_fd

2007-12-15 Thread Gustavo J. A. M. Carneiro
Gustavo J. A. M. Carneiro added the comment: The patch looks great. But I was wondering if there is any chance to export a C API in addition to the Python one? That is because PyGTK is mostly C, the code that needs this is C, it would be easier to call a C API. -- nosy: +gustavo

[issue1583] Patch for signal.set_wakeup_fd

2007-12-15 Thread Gustavo J. A. M. Carneiro
Changes by Gustavo J. A. M. Carneiro: __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1583 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman

[issue1564547] Py_signal_pipe

2007-12-09 Thread Gustavo J. A. M. Carneiro
Gustavo J. A. M. Carneiro added the comment: Minimal patch that just adds the pipe but does not attempt to fix anything else. Added file: http://bugs.python.org/file8898/python-signals-minimal.diff _ Tracker [EMAIL PROTECTED] http://bugs.python.org

[issue1564547] Py_signal_pipe

2007-12-09 Thread Gustavo J. A. M. Carneiro
Gustavo J. A. M. Carneiro added the comment: The minimal patch doesn't initialize dummy_char or dummy_c. It's harmless here, but please fix it. ;) The variable is called 'dummy' for a reason. The value written or read is irrevelant... _ Tracker [EMAIL

[issue1564547] Py_signal_pipe

2007-12-07 Thread Gustavo J. A. M. Carneiro
Gustavo J. A. M. Carneiro added the comment: My understanding is that there are some things that the current patch does not address. Well, I don't know what those things are, so it's hard for me to address them. :-) _ Tracker [EMAIL PROTECTED] http