[issue45339] concurrent.future.ThreadPoolExecutor should parameterize class used for threads

2021-10-04 Thread Erick
Erick added the comment: It also occurs to me that even if `concurrent.futures` adopted an alternative Thread class, it would still be preferable to allow for composition in the manner that was originally proposed. -- ___ Python tracker <ht

[issue45339] concurrent.future.ThreadPoolExecutor should parameterize class used for threads

2021-10-04 Thread Erick
Erick added the comment: > What are examples of your some_important_context()? Is it important to call > some code before destroying the thread? To be honest, pulled a context manager example out of thin air to illustrate the point. But sure, I want to allocate a resource before the

[issue45339] concurrent.future.ThreadPoolExecutor should parameterize class used for threads

2021-10-04 Thread Erick
Erick added the comment: > Can you apply some custom logic by specifying the initializer? Not sure that I follow; how would I use a context manager with the initializer? Of course this is just one example. In the `threading` docs, the second sentence in the description of the `Thread.

[issue45339] concurrent.future.ThreadPoolExecutor should parameterize class used for threads

2021-10-01 Thread Erick
New submission from Erick : Currently the only way to use a class other than `threading.Thread` with `concurrent.futures.ThreadPoolExecutor` is to extend `ThreadPoolExecutor` and override the private method `_adjust_thread_count()`. For example, suppose I have a class that applies some

[issue24676] Error in pickle using cProfile

2015-07-20 Thread Erick Fonseca
New submission from Erick Fonseca: cPickle raises a PicklingError when trying to pickle an instance of a class defined in a module being profiled with cProfile. Example code: import cPickle class A(object): pass a = A() with open('file.dat',

[issue9698] When reusing an handler, urllib(2)'s digest authentication fails after multiple regative replies

2015-02-12 Thread Erick Jones
Erick Jones added the comment: This ended up biting me also. I had a list of URLs to fetch with authentication. One of the URLs was bad (returning 401 even with authentication), and that was causing all of the subsequent URLs to fail as well since the reset count wasn't getting rese

[issue10811] sqlite segfault with generators

2011-01-02 Thread Erick Tryzelaar
New submission from Erick Tryzelaar : I found that the sqlite3 function executemany module crashes when passed in a generator that it iself is executing a query. It looks like this confuses the statement cache, and causes it to get cleared inappropriately in this case. I've attached a

[issue6651] Py3k's posixpath.relpath not compatible with ntpath.relpath

2009-08-05 Thread Erick Tryzelaar
New submission from Erick Tryzelaar : It looks like Python 3.x's relpath isn't compatible between posixpath and ntpath. In posixpath.relpath, the start keyword defaults to None, but ntpath.relpath, the start keyword defaults to curdir. Interestingly enough, 2.6 and 2.7 have a

[issue6154] Python 3.1 rc1 will not build on OS X 10.5.7

2009-05-31 Thread Erick Tryzelaar
Erick Tryzelaar added the comment: Benjamin, I just applied that patch but I still got the same error: /usr/bin/libtool -o Python.framework/Versions/3.1/Python -dynamic libpython3.1.a \ -lSystem -lSystemStubs -arch_only i386 - install_name /opt/local

[issue4573] zsh-style subpattern matching for fnmatch/glob

2009-04-01 Thread Erick Tryzelaar
Erick Tryzelaar added the comment: I completely agree, Georg. I tried to get this in before 3.0, but it didn't work out which is a shame. I assume you also feel that we couldn't make a backwards compatible change in 3.1, right? I thought I heard that 3.1 may break some things in 3.

[issue5456] io.StringIO's universal newlines support is broken in 3.0.1

2009-03-08 Thread Erick Tryzelaar
New submission from Erick Tryzelaar : Python version 3.0.1's io.StringIO has a bug when trying to use universal newlines on the mac. It's fixed in 3.1a1 though. Here's the exception: >>> io.StringIO('hello there\r\nlela\r\n', newline=None).readlines() Traceba

[issue5451] patch to make io.StringIO consistent with open with respect to newlines

2009-03-08 Thread Erick Tryzelaar
Erick Tryzelaar added the comment: Moving this to a documentation bug here: http://bugs.python.org/issue5452 -- message_count: 3.0 -> 4.0 ___ Python tracker <http://bugs.python.org/iss

[issue5452] Documentation for io.StringIO has wrong info for arguments

2009-03-08 Thread Erick Tryzelaar
New submission from Erick Tryzelaar : (this is redirecting from http://bugs.python.org/issue5451). The documentation for io.StringIO is incorrect on the arguments. First off, it doesn't actually accept the "encoding" and "errors" arguments. Second, it's not st

[issue5451] patch to make io.StringIO consistent with open with respect to newlines

2009-03-08 Thread Erick Tryzelaar
Erick Tryzelaar added the comment: Thanks Benjamin. Could the documentation for StringIO be updated then? The docs for io.StringIO [1] says that io.TextIOWrapper implements the constructor, but TextIOWrapper defaults newline to None [2], and there's nothing that states that io.Str

[issue5451] patch to make io.StringIO consistent with open with respect to newlines

2009-03-08 Thread Erick Tryzelaar
New submission from Erick Tryzelaar : I noticed that io.StringIO is inconsistent with open on how newlines are handled. The default approach open uses is universal newlines: >>> with open('foo', 'w') as f: ... f.write('hello hi\r\nla la\r\n') ... 17 &

[issue5449] bug fix to prevent io.BytesIO from accepting arbitrary keyword arguments

2009-03-08 Thread Erick Tryzelaar
New submission from Erick Tryzelaar : I noticed that it was possible to specify arbitrary arguments to io.BytesIO: >>> io.BytesIO(b'foo', foo=1) <_io.BytesIO object at 0x430150> But io.StringIO doesn't: >>> io.StringIO('foo', foo=1) Traceba

[issue5115] Extend subprocess.kill to be able to kill process groups

2009-01-30 Thread Erick Tryzelaar
New submission from Erick Tryzelaar : It would be really handy to add a way to portably kill process groups of a process spawned with subprocess.Popen. My project starts a process, which then starts other long running processes. Because of this process tree, there's no way for me to por

[issue4375] inspect.getsource doesn't work with PYTHONPATH and source compiled from a different dir

2009-01-30 Thread Erick Tryzelaar
Erick Tryzelaar added the comment: I just checked, and the latest svn version of python has fixed this. Could someone close this bug for me? ___ Python tracker <http://bugs.python.org/issue4

[issue4904] Typo for PickingError in pickle.py

2009-01-09 Thread Erick Tryzelaar
New submission from Erick Tryzelaar : Noticed that in the release version of python 3.0 and the latest svn that on line 835 the exception UnpickingError is raised instead of UnpicklingError. -- components: Library (Lib) messages: 79531 nosy: erickt severity: normal status: open title

[issue4727] pickle/copyreg doesn't support keyword only arguments in __new__

2008-12-22 Thread Erick Tryzelaar
New submission from Erick Tryzelaar : According to both of these bugs: http://bugs.python.org/issue1398 http://bugs.python.org/issue4331 pickle can't pickle functools.partial objects. It looks the underlying reason is that objects that pickle can't handle objects with __new__ an

[issue4573] zsh-style subpattern matching for fnmatch/glob

2008-12-07 Thread Erick Tryzelaar
New submission from Erick Tryzelaar <[EMAIL PROTECTED]>: As I mentioned on python-ideas, I my project needs to extend fnmatch to support zsh-style globbing, where you can use brackets to designate subexpressions. Say you had a directory structure like this: foo/ foo.ext1 foo.ex

[issue4375] inspect.getsource doesn't work with PYTHONPATH and source compiled from a different dir

2008-11-21 Thread Erick Tryzelaar
New submission from Erick Tryzelaar <[EMAIL PROTECTED]>: I'm running into a similar problem as Jean-Paul in: http://bugs.python.org/issue4223 But the patch in it doesn't work for me. My issue is also with files compiled already with python3.0, but then being accessed f

[issue4322] function with modified __name__ uses original name when there's an arg error

2008-11-13 Thread Erick Tryzelaar
New submission from Erick Tryzelaar <[EMAIL PROTECTED]>: I ran into a case where I modified the __name__ attribute of a function and then didn't specify the right number of arguments, and I got a TypeError that used the original function name, as demonstrated here: >>

[issue4321] unintended syntax error with decorators, parenthesis, and dots?

2008-11-13 Thread Erick Tryzelaar
New submission from Erick Tryzelaar <[EMAIL PROTECTED]>: I believe I found an unintentional syntax error with a combination of decorators, parenthesis, and dots. Here's a demonstration: class C: def prop(self, function): return property(function) class F: @C().prop

[issue4012] Minor errors in multiprocessing docs

2008-10-24 Thread Erick Tryzelaar
Erick Tryzelaar <[EMAIL PROTECTED]> added the comment: fyi, the multiprocessing docs also refer to applyAync, but the function was renamed to apply_async. This is also in the python 3.0 docs. -- nosy: +erickt versions: +Python 3.0 ___ Python t

[issue4170] segfault with defaultdict and pickle

2008-10-22 Thread Erick Tryzelaar
New submission from Erick Tryzelaar <[EMAIL PROTECTED]>: It seems like there's a bug with defaultdict. This is segfaulting with the latest python 3.0 svn checkout: import collections, pickle d=collections.defaultdict(int) d[1] pickle.dumps(d) It errors out with: Asser

[issue3290] python-config --cflags includes irrelevant flags

2008-09-26 Thread Erick Tryzelaar
Erick Tryzelaar <[EMAIL PROTECTED]> added the comment: fyi, on the mac with gcc-4.2, distutils is erroring out because of the "- Wno-long-double" it is getting from "python-config --cflags", as it's no longer accepted as an argument. Fortunately this can be work

[issue3976] pprint._safe_repr is not general enough in one instance

2008-09-26 Thread Erick Tryzelaar
Erick Tryzelaar <[EMAIL PROTECTED]> added the comment: fyi, I found another case where pprint needs a "safe sort", this is when you have a list that contains a dictionary. Anyway, Here's a simple patch that creates a _safe_sorted function that implements the fallback

[issue3976] pprint._safe_repr is not general enough in one instance

2008-09-26 Thread Erick Tryzelaar
New submission from Erick Tryzelaar <[EMAIL PROTECTED]>: I've run into a case where pprint isn't able to print out a particular data structure, and have distilled it down to a simple example: import pprint class A: pass pprint.pprint({A(): 1, A(): 2}) Which throw

[issue3717] Py_InitModule* is still referenced in docs

2008-08-28 Thread Erick Tryzelaar
Erick Tryzelaar <[EMAIL PROTECTED]> added the comment: On Thu, Aug 28, 2008 at 1:48 PM, Erick Tryzelaar <[EMAIL PROTECTED]> wrote: > > New submission from Erick Tryzelaar <[EMAIL PROTECTED]>: > > The docs still reference Py_InitModule*, which was removed in r641

[issue3717] Py_InitModule* is still referenced in docs

2008-08-28 Thread Erick Tryzelaar
New submission from Erick Tryzelaar <[EMAIL PROTECTED]>: The docs still reference Py_InitModule*, which was removed in r64107. Also, Demo/embed/demo.c still use Py_InitModule, and thus doesn't compile. -- assignee: georg.brandl components: Documentation messages: 72111 n

[issue3715] hashlib's docstring throws exception in pydoc

2008-08-28 Thread Erick Tryzelaar
New submission from Erick Tryzelaar <[EMAIL PROTECTED]>: Hello, I noticed that doing "pydoc3.0 hashlib" was throwing this exception: Traceback (most recent call last): File "/opt/local/bin/pydoc3.0", line 5, in pydoc.cli() File "/opt/local/Library/Frame

[issue3564] making partial functions comparable

2008-08-16 Thread Erick Tryzelaar
New submission from Erick Tryzelaar <[EMAIL PROTECTED]>: functools.partial functions are not comparable, in both python 2.5 and 3.0: >>> def foo(): pass >>> functools.partial(foo) == functools.partial(foo) False It can be worked around by comparing the func, args,

[issue3514] pickle segfault with infinite loop in __getattr__

2008-08-07 Thread Erick Tryzelaar
Erick Tryzelaar <[EMAIL PROTECTED]> added the comment: > Guido van Rossum <[EMAIL PROTECTED]> added the comment: > > Does this occur in 2.6 or 2.5? It doesn't in python 2.5. The RuntimeError manages to get printed out. I don't have 2.6 installed to test ag

[issue3514] pickle segfault with infinite loop in __getattr__

2008-08-07 Thread Erick Tryzelaar
New submission from Erick Tryzelaar <[EMAIL PROTECTED]>: I found a segfault in pickle.load when you overload __getattr__ and create yourself a infinite loop in the latest svn checkout of python 3: import pickle class Foo: def __getattr__(sel

[issue3414] frameworkinstall doesn't create Python.app, which breaks python

2008-07-18 Thread Erick Tryzelaar
New submission from Erick Tryzelaar <[EMAIL PROTECTED]>: Hello again! It looks like doing "make frameworkinstall maninstall" isn't creating "Python.framework/Versions/3.0/Resources/Python.app", so when I try to run python it errors out with: "python3.0: e

[issue3413] typo in Mac/Makefile.in breaks installing IDLE

2008-07-18 Thread Erick Tryzelaar
New submission from Erick Tryzelaar <[EMAIL PROTECTED]>: There's a slight typo in Mac/Makefile.in, where DESDIR was used instead of DESTDIR. This patch fixes it: --- /tmp/Makefile.in2008-07-18 19:42:29.0 -0700 +++ Mac/Makefile.in 2008-07-18 19:42:33.0 -070

[issue3267] yield in list comprehensions possibly broken in 3.0

2008-07-02 Thread Erick Tryzelaar
New submission from Erick Tryzelaar <[EMAIL PROTECTED]>: This may be a known consequence of python 3.0, but I couldn't find any reference to it, nor a test case that covers it. Here's a valid use of yield in 2.5.1: >>> def foo(): ... x=[(yield x) for x in 1,2,3] ..

[issue3174] 3.0b1 doesn't seem to install on macs

2008-06-23 Thread Erick Tryzelaar
Erick Tryzelaar <[EMAIL PROTECTED]> added the comment: Hello again, I then have problems with it finding MacOS.py in the BuildApplet.py script: DYLD_FRAMEWORK_PATH=/opt/local/var/macports/build/_Users_Shared_erickt_Projects_macports_dports.git_lang_python30/work/Python-3.0b1: ../pyth

[issue3174] 3.0b1 doesn't seem to install on macs

2008-06-23 Thread Erick Tryzelaar
Erick Tryzelaar <[EMAIL PROTECTED]> added the comment: I should add the error message: DYLD_FRAMEWORK_PATH=/opt/local/var/macports/build/_Users_Shared_erickt_P rojects_macports_dports.git_lang_python30/work/Python-3.0b1: ../python.exe ./scripts/cachersrc.py -v /opt/local/var/macports

[issue3174] 3.0b1 doesn't seem to install on macs

2008-06-23 Thread Erick Tryzelaar
New submission from Erick Tryzelaar <[EMAIL PROTECTED]>: Revision r63851 [1] by Benjamin Peterson removed a couple mac scripts, including cachersrc.py. Unfortunately, this script is still referenced in Mac/Makefile.in, so it fails to install on my mac. Anyone have a workaround I could a

[issue1753] TextIOWrapper.write writes utf BOM for every string

2008-01-07 Thread Erick Tryzelaar
New submission from Erick Tryzelaar: I was playing around with python 3's io functions, and I found that when trying to write to an encoded utf-16 file that TextIOWrapper.write re-writes the utf-16 bom for every string: >>> f=open('foo', 'w', encoding=