Daniel Stutzbach added the comment:
On Sat, May 8, 2010 at 11:02 AM, Martin v. Löwis wrote:
> Did you mean to include the hunk from msg105295 as part of the patch?
> If so, wouldn't that defeat the whole point of the patch?
My intention is to offer two compilation modes to extens
Daniel Stutzbach added the comment:
On Sat, May 8, 2010 at 11:20 AM, Martin v. Löwis wrote:
> I'd rather modify PyModuleDef_Base, to include a flags field, and
> perhaps put the api version into it, as well. That's an ABI change,
> unfortunately, but such a flags field
Daniel Stutzbach added the comment:
On Sat, May 8, 2010 at 11:35 AM, Marc-Andre Lemburg
wrote:
> One of the more important cases you are missing is the
> argument parser in Python:
Thanks. I've had my head buried in c-api/unicode.html and unicodeobject.h.
> Py_UNICODE *x;
Daniel Stutzbach added the comment:
In Unicode-agnostic mode, instead of leaving Py_UNICODE, PyUnicodeObject, and
many functions undefined, I wonder if it would be sufficient to declare
Py_UNICODE like this:
struct PY_UNICODE_TYPE;
typedef struct PY_UNICODE_TYPE Py_UNICODE;
That would allow
New submission from Daniel Stutzbach :
Using a UCS2 Python on a platform with a 32-bit wchar_t, the following code
throws an exception (but should not):
>>> ctypes.c_wchar('\u1')
Traceback (most recent call last):
File "", line 1, in
TypeError: one character
Daniel Stutzbach added the comment:
On Sat, May 8, 2010 at 8:07 AM, Martin v. Löwis wrote:
> 1. add a flag to PyModuleDef, indicating whether the module was built in
> UCS-2 or UCS-4 mode. Then let the interpreter refuse the load the module,
> instead of having the dynamic linker
Daniel Stutzbach added the comment:
On Sun, May 9, 2010 at 10:12 AM, Marc-Andre Lemburg
wrote:
> I'm just not sure how you could check for optimization
> compiler bugs/features using the buildbots.
>
Once I have a patch that I'm modestly confident in, I'll write autom
Changes by Daniel Stutzbach :
Removed file: http://bugs.python.org/file17273/unnamed
___
Python tracker
<http://bugs.python.org/issue8654>
___
___
Python-bugs-list mailin
Changes by Daniel Stutzbach :
Removed file: http://bugs.python.org/file17274/unnamed
___
Python tracker
<http://bugs.python.org/issue8654>
___
___
Python-bugs-list mailin
Changes by Daniel Stutzbach :
Removed file: http://bugs.python.org/file17248/unicode.patch
___
Python tracker
<http://bugs.python.org/issue8654>
___
___
Python-bugs-list m
Daniel Stutzbach added the comment:
Here is a new patch.
Usage, short version:
By default, modules compile in Unicode-agnostic mode, where Py_UNICODE is an
incomplete type. Unicode-agnostic modules will load in both UCS2 and UCS4
interpreters.
If a module defines PY_REAL_PY_UNICODE
Daniel Stutzbach added the comment:
On Tue, May 11, 2010 at 11:55 AM, Giampaolo Rodola'
wrote:
> Moreover, reset() and delay() methods are not implemented in sched.
>
> Other problems which comes to mind are: you can't easily know whether a call
> has already bee
New submission from Daniel Stutzbach :
(Making an educated guess about who to add to the Nosy list)
Attached is a patch to improve math.factorial by using a divide-and-conquer
algorithm. The old algorithm performs n-1 multiplications, mostly on numbers
with a very large number of digits
Daniel Stutzbach added the comment:
On Tue, May 11, 2010 at 4:18 PM, Alexander Belopolsky
wrote:
> While the error message is wrong in both cases, I think OverflowError is a
> better exception in this case and there should not be a difference between
> math.factorial(2.
Daniel Stutzbach added the comment:
On Tue, May 11, 2010 at 5:33 PM, Alexander Belopolsky
wrote:
> It seems to me that the value of n for which number of digits will exceed
> sys.maxsize can be estimated fairly accurately using Stirling formula. Only
> two values are relevant in
Daniel Stutzbach added the comment:
On Tue, May 11, 2010 at 7:15 PM, Alexander Belopolsky
wrote:
> The main value in setting a theoretically justified limit is that
> overflow exception can carry a meaningful message, e.g. "factorial
> result would have too many digits&qu
Daniel Stutzbach added the comment:
On Tue, May 11, 2010 at 7:38 PM, Alexander Belopolsky
wrote:
> Speaking of micro-optimizations, did you consider a better than naive
> algorithm for "Count the number of set bits in n" in your patch?
> HAKMEM 169 comes to mind and being a
Daniel Stutzbach added the comment:
Thank you both for the valuable feedback. I'm working on a revised patch that
incorporates your many suggestions.
I decided to use an iterative version for two reasons:
- the reference has a note at the bottom in a tiny font suggesting it
- I fou
Daniel Stutzbach added the comment:
On Wed, May 12, 2010 at 10:31 AM, Alexander Belopolsky
wrote:
> if ((k & 1) != 1)
> k = k - 1;
>
> looks odd to me. Maybe k += (k & 1) - 1?
If we change the logic slightly to put the odd entry on the right
instead of the left, w
Daniel Stutzbach added the comment:
On Wed, May 12, 2010 at 12:59 PM, Mark Dickinson wrote:
> (4) And please do restore the PyLong_FromDouble line in the main routine,
> rather than using a C double-to-long cast. The direct conversion again leads
> to undefined behaviour for larg
Daniel Stutzbach added the comment:
On Wed, May 12, 2010 at 3:34 PM, Alexander Belopolsky
wrote:
> I wonder if one could write an elegant recursive version that would
> multiply first by last in partial_product.
That could be done with a three-parameter partial_product, where the
New submission from Daniel Stutzbach :
If the CGI script crashes before finishing the headers, cgitb will emit invalid
HTTP headers before showing the error message. Below are HTTP headers I
received, captured with a packet sniffer. Note the "<--: spam".
HTTP/1.1 200 OK
Date
Changes by Daniel Stutzbach :
--
keywords: +easy
___
Python tracker
<http://bugs.python.org/issue8704>
___
___
Python-bugs-list mailing list
Unsubscribe:
Daniel Stutzbach added the comment:
After experimenting with changing the order of the multiplications and not
having much luck, I went back and looked for other differences in Alexander's
Python functions that might cause the speed difference. I believe
partial_product2 is fast becau
Daniel Stutzbach added the comment:
Isn't it amazing how fast one can make incorrect code? ;-)
Here is a fixed version of my partial_product3, but now it is no faster than
partial_product.
def partial_product3(j, i):
a = [l << 1 | 1 for l in range(j, i + 1)]
n = len(a)
Daniel Stutzbach added the comment:
Speaking of getting side-tracked, I didn't see an answer to a question I asked
earlier. I'd like to get some feedback before I proceed with revising the
patch.
For the find-last-set-bit (to replace log2) and count-set-bits operations,
w
Daniel Stutzbach added the comment:
That's a clever idea. Do you have a Python script that generates the
precomputed values?
--
___
Python tracker
<http://bugs.python.org/i
Daniel Stutzbach added the comment:
It's a little too clever though. It gives the wrong answer for 29!.
I'll have a revised version of my patch done sometime tomorrow.
--
___
Python tracker
<http://bugs.python.
Daniel Stutzbach added the comment:
Attached is a patch to improve the unit tests for the factorial function.
To compute the check value, it keeps a running total instead of recomputing the
factorial from scratch inside the loop. It checks up to range(999) and is
quite fast. The previous
Daniel Stutzbach added the comment:
Attached is a simple bash script to run math.factorial(n) through timeit for
several values of n. It makes comparing the speed of different builds MUCH
easier.
--
Added file: http://bugs.python.org/file17329/factorial-speed.sh
Daniel Stutzbach added the comment:
It displays correctly in some browsers, yes, but not everything that speaks
HTTP is a browser. For example, the invalid header makes C#'s WebRequest throw
an exception.
I hadn't noticed the 'Content-Type' on the next line of the str
Changes by Daniel Stutzbach :
Removed file: http://bugs.python.org/file17300/factorial.patch
___
Python tracker
<http://bugs.python.org/issue8692>
___
___
Python-bug
Daniel Stutzbach added the comment:
The resolution on this bug reads, "In future versions of Python, Guido
would like to change the design to hide the induction variable. So,
someday, you'll get your wish."
Can this bug be re-opened and the wart removed in 3.0?
--
n
Daniel Stutzbach added the comment:
Wonderful!
_
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1110705>
_
___
Python-bugs-list mailing list
Unsubs
New submission from Daniel Stutzbach <[EMAIL PROTECTED]>:
_winreg.EnumValue raises a WindowsError ("More data is available") if
the registry data includes multibyte unicode characters.
Inspecting PyEnumValue in _winreg.c, I believe I see the problem. The
function uses Re
Daniel Stutzbach <[EMAIL PROTECTED]> added the comment:
The bug is in both.
On Sat, May 10, 2008 at 12:52 PM, Martin v. Löwis
<[EMAIL PROTECTED]> wrote:
>
> Martin v. Löwis <[EMAIL PROTECTED]> added the comment:
>
> Is that for Python 2.5 or 3.0?
Daniel Stutzbach <[EMAIL PROTECTED]> added the comment:
After several failed attempts at making a test case, and stepping
through C code with a debugger, I see that my initial diagnose is
quite wrong. RegQueryInfoKey *does* return the sizes in units of
bytes (even though the Mic
Daniel Stutzbach added the comment:
I've looked very quickly over your patches to try to figure what rule
qualifies a tuple or dict as simple enough to be untracked, out of
curiosity.
For tuples, I think the rule is:
If an object is immutable, and it points only to untracked objects
Daniel Stutzbach added the comment:
Unfortunately, the check is O(n), so it can get a little expensive. I
suppose that's no worse than traversing the tuple to look for a cycle,
though. Perhaps it could be done at the same time?
Can _PyObject_GC_UNTRACK() be safely called from tp_tra
Changes by Daniel Stutzbach :
--
nosy: +stutzbach
___
Python tracker
<http://bugs.python.org/issue1303434>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Daniel Stutzbach :
The PyTypeObject field "tp_version_tag" (new in 2.6) isn't documented.
"tp_del" isn't documented either. I'm not sure when it was added.
--
assignee: georg.brandl
components: Documentation
messages: 79755
nos
New submission from Daniel Stutzbach :
The documentation for super() describes the arguments that can be passed
to super(), use cases for super(), an example, and caveats about what
cannot be done with the returned object. However, the documentation
neglects to mention what super() actually
Daniel Stutzbach added the comment:
Yes, by citing that article I don't mean to endorse its opinions.
Regrettably, it's the best documentation on super() I could find (in an
admittedly quick search).
Any improvements efforts you make to improve the existing super()
documentation
Daniel Stutzbach added the comment:
If I'm understanding Martin Häcker's code correctly, the list comprehension
equivalent is:
self.questions = [topic.questions for topic in self.topics]
The reduce() variants are not only much harder to read, but they will take
O(n**2) operatio
Daniel Stutzbach added the comment:
Ah - in your first example (the one with 3 lines) did you mean to use .extend
instead of .append?
--
___
Python tracker
<http://bugs.python.org/issue13
Daniel Stutzbach added the comment:
On Fri, Apr 6, 2012 at 12:51 PM, Jim Jewett wrote:
> __del__ methods do run, even if an object was collected by the cycle
> detector. And they can't do any harm that couldn't also be done by a C
> finalizer.
>
No, if an object wi
Daniel Stutzbach added the comment:
Are __del__ and tp_del getting conflated in this conversation? I don't see a
__del__ method on generator objects:
filfre:$ python3.1
Python 3.1.2 (r312:79147, Dec 9 2011, 20:47:34)
[GCC 4.4.3] on linux2
>>> (i for i in range(5)).__del__
T
Daniel Stutzbach added the comment:
Wouldn't the subclass inherit the False value? Then the user would need to
remember to override the value again in the subclass, which is error prone.
Antoine: I've used the pattern you describe on a couple of occasions, and it
routinely confus
Daniel Stutzbach added the comment:
On Tue, Apr 17, 2012 at 4:08 AM, Antoine Pitrou wrote:
> has_finalizer() in gcmodule.c doesn't check for weakref callbacks, so a
> weakref callback can still be invoked from tp_dealloc.
Unless I'm mistaken, weakrefs will be handle
Daniel Stutzbach added the comment:
As the person originally trying to take the mean of timedelta objects, I'm
personally fine with the workaround of:
py> m = statistics.mean([x.total_seconds() for x in data])
py> td(seconds=m)
datetime.timedelta(2, 43200)
At the time I was trying
Changes by Daniel Stutzbach :
--
assignee: stutzbach -> rhettinger
___
Python tracker
<http://bugs.python.org/issue2226>
___
___
Python-bugs-list mai
Changes by Daniel Stutzbach :
--
nosy: +stutzbach
___
Python tracker
<http://bugs.python.org/issue19081>
___
___
Python-bugs-list mailing list
Unsubscribe:
Daniel Stutzbach added the comment:
I'll test your patch on Windows. Are you working against the trunk or
the py3k branch?
--
___
Python tracker
<http://bugs.python.org/i
Daniel Stutzbach added the comment:
I'm only setup to test the official Windows build setup under PCbuild.
I'm not testing the legacy build setups under PC/VC6, PC/VS7.1, or PC/VS8.0.
The patch against the trunk failed for PC/VC6/pythoncore.dsp. I don't
need that to build
Daniel Stutzbach added the comment:
I agree with your reasoning.
Any chance of also getting the incomplete beta and gamma functions,
needed to compute the CDF of many commonly used probability
distributions? (Beta, Logarithmic, Poisson, Chi-Square, Gamma, etc
New submission from Daniel Stutzbach :
I noticed that file_close() calls close_the_file(), then frees the
buffer for the file object. However, close_the_file() may fail and
return NULL if the file object is currently in use by another thread, in
which case freeing the buffer from underneath the
Changes by Daniel Stutzbach :
Added file: http://bugs.python.org/file15077/crash.py
___
Python tracker
<http://bugs.python.org/issue7079>
___
___
Python-bugs-list mailin
New submission from Daniel Stutzbach :
2.6 introduced several new functions to the signal module that are not
available on Windows (setitimer, getitimer, and siginterrupt). However,
they aren't documented with Availability: Unix.
--
assignee: georg.brandl
components: Document
New submission from Daniel Stutzbach :
The following is from Lib/test/test_descr.py. It's trying to test if
looking up a special method on an object leaks references. It tests it
by using __cmp__. The test will always pass because Python 3 is trying
to look up __eq__, not __cmp__.
Daniel Stutzbach added the comment:
After some searching around with Google, "2>&-" means "close file
descriptor 2" (i.e., standard error).
--
nosy: +stutzbach
___
Python tracker
<ht
Daniel Stutzbach added the comment:
Is it even possible to portably test the validity of a file descriptor
without trying to write/read it?
When I first saw this bug, my gut feeling was "well, don't do that
then!" However, I then recalled that Windows GUI applications have n
New submission from Daniel Stutzbach :
The documentation for os.putenv states that "changes to the environment
affect subprocesses started with os.system(), popen() or fork() and
execv()" and "assignments to items in os.environ are automatically
translated into corresponding
New submission from Daniel Stutzbach :
I'm in the process of converting several Python scripts so that they
work under both Python 2.6 and 3.1. For the most part, 2to3 does an
amazing job. Great tool.
One little feature request: could we make it add "from __future__ import
print_sta
Changes by Daniel Stutzbach :
--
nosy: +stutzbach
___
Python tracker
<http://bugs.python.org/issue6672>
___
___
Python-bugs-list mailing list
Unsubscribe:
Daniel Stutzbach added the comment:
svn.python.org seems to be up again. Could you create a patch?
--
___
Python tracker
<http://bugs.python.org/issue6
New submission from Daniel Stutzbach :
The documentation for weakref contains the following example:
http://docs.python.org/3.1/library/weakref.html
--
Several built-in types such as list and dict do not directly support
weak references but can add
Daniel Stutzbach added the comment:
I parsed the documentation this way:
"Several built-in types such as list and dict do not directly support
weak references" (true)
"but [all of those that do not directly support weak references] can add
support through subclassing"
I w
Daniel Stutzbach added the comment:
That's fair. I suggest the following change:
current text:
"Several built-in types such as list and dict do not directly support
weak references but can add support through subclassing:"
new text:
"Several built-in types such as
New submission from Daniel Stutzbach :
Currently, msvccompiler.py defines NDEBUG for non-debug builds. Unix
builds do as well, via python-config. However, cygwinccompiler.py does not.
--
assignee: tarek
components: Distutils
messages: 94315
nosy: stutzbach, tarek
severity: normal
Daniel Stutzbach added the comment:
Sorry, I should have said the mingw32 compiler, which is contained in
cygwincompiler.py The mingw32 compiler is a free compiler compatible
with MSVC. Since it's used with the Windows version of python, there is
no configure script.
I noticed this
Daniel Stutzbach added the comment:
Any time I've ever needed log2(x), log(x)/log(2) was sufficient.
In Python, exp2(x) can be spelled 2.0**x. What would exp2(x) gain us?
--
___
Python tracker
<http://bugs.python.org/i
Daniel Stutzbach added the comment:
Thanks! These improvements are very helpful. The one missing notion is
that "object-or-type" may be a proxy object, in which case super()
returns a new proxy that additionally skips "type".
Perhaps add the following sentence to
Daniel Stutzbach added the comment:
Actually, it's essential to how super() works. Here's an example using
single inheritance:
class A(object):
def foo(self):
print 'A'
class B(object):
def foo(self):
super(B, self).foo()
print 'B'
class C(objec
Daniel Stutzbach added the comment:
In the previous example, I meant to type
class B(A)
and
class C(B)
rather than having them all derive from object. That's what I get for
not actually testing the code. ;-)
___
Python tracker
<http://bugs.py
New submission from Daniel Stutzbach :
The documentation for PyDict_SetItemString contains the text "The key
object is created using PyString_FromString(key)". However,
PyString_FromString has been removed in Python 3.
Perhaps it should read PyUnicode_FromString?
-
New submission from Daniel Stutzbach :
Py_InitModule, Py_InitModule3, etc. are mentioned in the docs (including
the extending tutorial!), but no longer exist.
--
assignee: georg.brandl
components: Documentation
messages: 84044
nosy: georg.brandl, stutzbach
severity: normal
status: open
New submission from Daniel Stutzbach :
PyMODINIT_FUNC functions should return the module object or NULL on
error. Or at least that what it looks like the core modules are doing. ;-)
--
assignee: georg.brandl
components: Documentation
messages: 84045
nosy: georg.brandl, stutzbach
Changes by Daniel Stutzbach :
--
assignee: georg.brandl
components: Documentation
nosy: georg.brandl, stutzbach
severity: normal
status: open
title: PyModule_Create and PyModuleDef are undocumented
versions: Python 3.0, Python 3.1
___
Python tracker
Daniel Stutzbach added the comment:
That was quick! Thanks! :-)
--
___
Python tracker
<http://bugs.python.org/issue5549>
___
___
Python-bugs-list mailin
New submission from Daniel Stutzbach :
Below is the relevant snippet from pyport.h. There are two reasons that
Py_LOCAL_INLINE doesn't actually emit the "inline" keyword (unless
compiling with MSC).
First, "configure" does not have code to test the compiler
Daniel Stutzbach added the comment:
I don't think the compare is actually masking an exception.
The set type defines a tp_richcompare routine that gets called when
comparing them as members of a tuple, but the set type also defines a
tp_compare routine that does nothing but raise an exce
Daniel Stutzbach added the comment:
I created a simple parent/child pair using subprocess under cygwin and
Python 2.5 and for me closing stdout did not affect stdin.
It would appear the problem is caused by something else?
--
nosy: +stutzbach
Added file: http://bugs.python.org
Changes by Daniel Stutzbach :
Added file: http://bugs.python.org/file13464/child.py
___
Python tracker
<http://bugs.python.org/issue4295>
___
___
Python-bugs-list mailin
Daniel Stutzbach added the comment:
This patch looks good to me and applies cleanly to the trunk. Here's a
synopsis of the code (before the patch) in question:
static int
my_fgets(char *buf, int len, FILE *fp)
{
for(;;) {
/* a bunch of code that does not contain bre
New submission from Daniel Stutzbach :
The makefile lists Objects/stringlib/formatter.h as a dependency for
Objects/unicodeobject.o, which doesn't include formatter.h.
Python/formatter_unicode includes it, but doesn't list it as a dependency.
I've attached a patch for Makefile
Daniel Stutzbach added the comment:
Here's a patch to add tests for this and a few other problems with
formatting inf/-inf/nan, as well as a patch that fixes the problems.
--
keywords: +patch
nosy: +stutzbach
versions: +Python 2.7, Python 3.1
Added file: http://bugs.pytho
Changes by Daniel Stutzbach :
Added file: http://bugs.python.org/file13475/inf.patch
___
Python tracker
<http://bugs.python.org/issue4482>
___
___
Python-bugs-list mailin
Daniel Stutzbach added the comment:
I'm using gcc 3.4.4 (cygwin) and I get the sames warnings as Alexandre.
I examined a random sampling of the code generating the warnings, all of
which followed this pattern:
some_function((some_type **) &var_of_some_other_type);
Since the
Changes by Daniel Stutzbach :
--
versions: +Python 3.1
___
Python tracker
<http://bugs.python.org/issue4385>
___
___
Python-bugs-list mailing list
Unsubscribe:
Daniel Stutzbach added the comment:
Rolland,
The va_list is initialized by the function that calls objargs_mktuple.
va_start() and va_end() need to be called in the function that takes
"..." as a parameter, and it is.
Not a bug, but +1 on Alexander's patch to consolidate all t
Daniel Stutzbach added the comment:
I agree with Raymond.
In general, the collections module should define containers that are
named after their function rather than their implementation. That way
the implementation can be changed at a later date (or in other Python
implementations) without
New submission from Daniel Stutzbach :
A few spots are missing #ifdef WITH_THREAD
I've included a patch for the relevant bits.
--
components: Extension Modules, Interpreter Core
files: without-threads.patch
keywords: patch
messages: 84673
nosy: stutzbach
severity: normal
status:
Daniel Stutzbach added the comment:
Daniel,
_closedsocket is a global, so it isn't safe to be used within __del__
during shutdown.
In the py3k branch, socket.__del__ calls socket._real_close which
references the global _socket. So it's not safe their, either.
--
nosy:
Changes by Daniel Stutzbach :
--
nosy: +stutzbach
___
Python tracker
<http://bugs.python.org/issue1641>
___
___
Python-bugs-list mailing list
Unsubscribe:
Daniel Stutzbach added the comment:
The patch I submitted adds a special-case for inf/-inf/NaN so that
sprintf is avoided for those values. Should work on any platform, I
believe.
I'm not sure how it interacts with your 3.x plans. Seems like it would
be a good patch for 2.7 at least, t
New submission from Daniel Stutzbach :
I noticed this in 2.6, but I imagine it affects 2.7, and 3.x as well.
The documentation for _winreg.OpenKey reads in part:
_winreg.OpenKey(key, sub_key[, res=0][, sam=KEY_READ])
However:
>>> import _winreg
>>> _winreg.OpenKey(_winreg
Daniel Stutzbach added the comment:
I used 'inf' instead of "+inf' because the original bug report states
that the docs say it should be 'inf'.
Now that I actually look at the docs, I don't agree with the original
report's interp
New submission from Daniel Stutzbach :
It looks like PEP 362 has been implemented in the py3k branch:
>>> def f(x: int):
... pass
...
>>>
--
components: None
messages: 87125
nosy: stutzbach
severity: normal
status: open
title: PEP 362 can be marked as finished?
ve
Daniel Stutzbach added the comment:
You're right. I got them mixed up. Please disregard. I'm just having
that kind of day. :-)
--
___
Python tracker
<http://bugs.python.
New submission from Daniel Stutzbach :
Likely affects Python 2.7 and Python3.x as well, but I have not checked.
Under Windows:
>>> tempfile.NamedTemporaryFile('w', delete = False)
TypeError: NamedTemporaryFile() got an unexpected keyword argument &
301 - 400 of 469 matches
Mail list logo