Re: [Python-Dev] Segfault

2007-08-23 Thread Hrvoje Nikšić
On Wed, 2007-08-22 at 21:32 -0700, Neal Norwitz wrote:
> Py_BEGIN_ALLOW_THREADS
> errno = 0;
> -   ret = _portable_fseek(f->f_fp, offset, whence);
> +   if (f->f_fp != NULL)
> +   ret = _portable_fseek(f->f_fp, offset, whence); 

Doesn't this kind of code retain a race condition?  Since this is an
"allow threads" section that runs with the GIL released, file_close
might acquire the GIL and be running in parallel to this code.  If
file_close sets f_fp to NULL after the "if" condition evaluates, but
before the call to _portable_fseek completes, we still get a segfault.

If I understand the Python threading model, the only reliable way to
resolve this is to protect the PyFileObject operations with a mutex.


___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] SF tracker closed now

2007-08-23 Thread martin
We are starting with the tracker conversion. Please stop using the bug  
trackers (either SF or roundup) until further notice.

Regards,
Martin


___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] SF tracker closed now

2007-08-23 Thread Martin von Löwis
[second copy, since the first one apparently did not go through]

We are starting with the tracker conversion. Please stop using 
the bug trackers (either SF or roundup) until further notice.

Regards,
Martin
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] New bug tracker is active now

2007-08-23 Thread Martin von Löwis
We have completed the conversion to Roundup as the bug tracker
for Python; the new tracker is now life at

  http://bugs.python.org/

It has all reports from the SourceForge tracker, along with
all messages and files that had been attached.

To edit bug reports, you still need to log in. We have migrated
all account names from SF as-is, but obviously couldn't migrate
the passwords as well. So you need to reset your password, through

  http://bugs.python.org/[EMAIL PROTECTED]

Fill your SF account name in the bottom field, wait for an email,
click on the link, wait for a second email, change your password
to something you can remember. All SF project members have developer
privileges in the roundup tracker.

If you find problems with that bug tracker, follow the Report Tracker
Link. This meta-tracker does *not* use the same accounts as the Python
tracker.

I'd like to take the opportunity to thank Erik Forsberg, who really did
the majority of the work involved in switching to roundup (along with
various people helping out).

Regards,
Martin
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Segfault

2007-08-23 Thread Neal Norwitz
On 8/23/07, Hrvoje Nikšić <[EMAIL PROTECTED]> wrote:
> On Wed, 2007-08-22 at 21:32 -0700, Neal Norwitz wrote:
> > Py_BEGIN_ALLOW_THREADS
> > errno = 0;
> > -   ret = _portable_fseek(f->f_fp, offset, whence);
> > +   if (f->f_fp != NULL)
> > +   ret = _portable_fseek(f->f_fp, offset, whence);
>
> Doesn't this kind of code retain a race condition?  Since this is an

Exactly what I'm thinking.  That's why I said:

I'm not convinced the attached patch is good enough though.

It definitely reduces the race and might fix the problem.

> "allow threads" section that runs with the GIL released, file_close
> might acquire the GIL and be running in parallel to this code.  If
> file_close sets f_fp to NULL after the "if" condition evaluates, but
> before the call to _portable_fseek completes, we still get a segfault.

However, the setting of f_fp to NULL happens with the GIL set, ie
while only one thread is running.  So I *think* (but I'm not sure) the
condition you mention is not possible.  Either way the fix seems
brittle.  (Also, the patch I attached was not complete.)

Also all this code has gone away in 3.0.

n
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] New bug tracker is active now

2007-08-23 Thread Sjoerd Mullender
On 2007-08-23 18:50, Martin von Löwis wrote:
> We have completed the conversion to Roundup as the bug tracker
> for Python; the new tracker is now life at
> 
>   http://bugs.python.org/

So far, I have one issue with the new tracker: the timezone.

When editing my details I saw there is a field for my timezone.  The
comment says: "this is a numeric hour offset, the default is UTC", so
I'm assuming it counts in whole hours (fine for me, not so fine for
people in e.g. India, unless it accepts decimal notation).  I have two
issues with this: it's unclear which direction this works (is East
positive or negative?), and I will need to change this number twice
yearly.  In other words, it shouldn't be a number, it should be a name,
like the names used in Linux: Europe/Amsterdam.

Looks nice otherwise.

-- 
Sjoerd Mullender

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] New bug tracker is active now

2007-08-23 Thread Martin v. Löwis
> When editing my details I saw there is a field for my timezone.  The
> comment says: "this is a numeric hour offset, the default is UTC", so
> I'm assuming it counts in whole hours (fine for me, not so fine for
> people in e.g. India, unless it accepts decimal notation).  I have two
> issues with this: it's unclear which direction this works (is East
> positive or negative?), and I will need to change this number twice
> yearly.  In other words, it shouldn't be a number, it should be a name,
> like the names used in Linux: Europe/Amsterdam.

I think this will be fairly difficult to fix. Roundup doesn't have
a timezone database; it just applies the delta to the UTC time. We are
merely using roundup, instead of developing it.

See

http://sourceforge.net/tracker/index.php?func=detail&aid=818711&group_id=31577&atid=402791

Regards,
Martin
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] New bug tracker is active now

2007-08-23 Thread Brett Cannon
On 8/23/07, Martin von Löwis <[EMAIL PROTECTED]> wrote:
> We have completed the conversion to Roundup as the bug tracker
> for Python; the new tracker is now life at
>
>   http://bugs.python.org/
>
> It has all reports from the SourceForge tracker, along with
> all messages and files that had been attached.
>
> To edit bug reports, you still need to log in. We have migrated
> all account names from SF as-is, but obviously couldn't migrate
> the passwords as well. So you need to reset your password, through
>
>   http://bugs.python.org/[EMAIL PROTECTED]
>
> Fill your SF account name in the bottom field, wait for an email,
> click on the link, wait for a second email, change your password
> to something you can remember. All SF project members have developer
> privileges in the roundup tracker.
>

Just so people know, if you are unhappy with your SF username, you can
change it after you get your password reset.  Just go to your details
page and change your username to whatever you want.  Personally, I
think they should match your svn.python.org account name but I don't
know if anyone else wants that as a suggestion or policy.

-Brett
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] PEP 302 optional extensions only for loaders?

2007-08-23 Thread Brett Cannon
When you read PEP 302 and the section on the optional extensions, it
mentions that they "are highly recommended for general purpose
importers".  But then the PEP says very shortly thereafter that
"loader objects" are to have the extensions.

So which is it, importers or loaders?  The reason I ask is because if
one can assume that the extensions are only called on what find_module
returns, and thus extensions are only called on loaders, then some
caching can be done based on what find_module had to do.  In my case I
am reimplementing zipimport and if I can assume find_module was called
before is_package I can just cache in the object what module names
were found to be a package and then have is_package just be a lookup
in a set instead of having to read the zip file every time or store
all of the ZipInfo files for the zipfile.

-Brett
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Final SF Python Patch/Bug Summary

2007-08-23 Thread Kurt B. Kaiser
New / Reopened Patches
__

minidom pretty xml output improvement  (2007-08-19)
   http://python.org/sf/1777134  opened by  Teajay

removeTest() method patch for unittest.TestSuite  (2007-08-21)
   http://python.org/sf/1778410  opened by  Mark Edgington

robotparser.py fixes  (2007-08-21)
   http://python.org/sf/1778443  opened by  Indy

Remove redundancies inside class logging.Logger  (2007-08-22)
   http://python.org/sf/1779550  opened by  Carsten Grohmann

Replace AtheOS w/ Syllable  (2007-08-22)
   http://python.org/sf/1779613  opened by  Skip Montanaro

Make python build with gcc-4.2 on OS X 10.4.9  (2007-08-23)
   http://python.org/sf/1779871  opened by  Jeffrey Yasskin

Patches Closed
__

distutils.util.get_platform() return value on 64bit Windows  (2007-07-27)
   http://python.org/sf/1761786  closed by  mhammond

MSVC6/7 issues with bdist_wininst and --target-version  (2004-07-01)
   http://python.org/sf/983164  closed by  mhammond

Override flags set by IOBase in io.StringIO  (2007-08-15)
   http://python.org/sf/1774828  closed by  avassalotti

Convert str to bytes in io.BytesIO.__init__  (2007-08-15)
   http://python.org/sf/1774833  closed by  avassalotti

BufReader, TextReader for PEP 3116 "New I/O"  (2007-06-04)
   http://python.org/sf/1731036  closed by  gvanrossum

utf-32 codecs  (2007-08-16)
   http://python.org/sf/1775604  closed by  gvanrossum

Make it possible to use SVK to develop Python  (2007-08-14)
   http://python.org/sf/1774414  closed by  collinwinter

New / Reopened Bugs
___

memoryview('test') is causing a segfault  (2007-08-19)
CLOSED http://python.org/sf/1777057  reopened by  tiran

Please warn about a subtle trap  (2007-08-19)
CLOSED http://python.org/sf/1777160  opened by  Greg Kochanski

Confusing typography Python Ref 5.9  (2007-08-19)
CLOSED http://python.org/sf/1777168  opened by  Greg Kochanski

IDLE Freezes After Running Scripts  (2007-08-19)
   http://python.org/sf/1777398  opened by  Ross Peoples

Python's strftime dislikes years before 1900  (2007-08-20)
   http://python.org/sf/1777412  opened by  Benno Rice

glob doesn't return unicode with unicode parameter  (2007-08-20)
   http://python.org/sf/1777458  opened by  Grzegorz Adam Hankiewicz

ctypes on Solaris  (2007-08-20)
   http://python.org/sf/1777530  opened by  Aki

rounding inconsisntency using string formatting  (2007-08-20)
CLOSED http://python.org/sf/1778207  opened by  Jim Hurlburt

Segfault.  (2007-08-21)
   http://python.org/sf/1778376  opened by  Maciek Fijalkowski

PyThreadState_SetAsyncExc and the main thread  (2007-08-22)
   http://python.org/sf/1779233  opened by  Rotem

urlparse.urljoin does not obey current uri rfc (rfc 3986)  (2007-08-22)
   http://python.org/sf/1779700  opened by  John Adams

Bugs Closed
___

memoryview('test') is causing a segfault  (2007-08-18)
   http://python.org/sf/1777057  closed by  nnorwitz

memoryview('test') is causing a segfault  (2007-08-18)
   http://python.org/sf/1777057  closed by  nnorwitz

Please warn about a subtle trap  (2007-08-19)
   http://python.org/sf/1777160  closed by  gbrandl

Confusing typography Python Ref 5.9  (2007-08-19)
   http://python.org/sf/1777168  closed by  gbrandl

struni: str() doesn't call __str__() of subclasses of str  (2007-07-11)
   http://python.org/sf/1751598  closed by  tiran

rounding inconsisntency using string formatting  (2007-08-21)
   http://python.org/sf/1778207  closed by  loewis

mapitags.PROP_TAG() doesn't account for new longs  (2004-12-31)
   http://python.org/sf/1093389  closed by  mhammond

Overenthusiastic check in Swap?  (2004-04-01)
   http://python.org/sf/926910  closed by  mhammond

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] PEP 302 optional extensions only for loaders?

2007-08-23 Thread Paul Moore
On 23/08/07, Brett Cannon <[EMAIL PROTECTED]> wrote:
> When you read PEP 302 and the section on the optional extensions, it
> mentions that they "are highly recommended for general purpose
> importers".  But then the PEP says very shortly thereafter that
> "loader objects" are to have the extensions.
>
> So which is it, importers or loaders?

Loaders. "general purpose importers" was sloppy terminology, meant to
mean "general purpose things that implement the new importing
protocol, as specified here".

Loaders are what implement the extensions, as made clear by the examples.

Apologies for the sloppy wording in the PEP.
Paul.
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Final SF Python Patch/Bug Summary

2007-08-23 Thread Brett Cannon
Thanks for having done these, Kurt!

-Brett

On 8/23/07, Kurt B. Kaiser <[EMAIL PROTECTED]> wrote:
> New / Reopened Patches
> __
>
> minidom pretty xml output improvement  (2007-08-19)
>http://python.org/sf/1777134  opened by  Teajay
>
> removeTest() method patch for unittest.TestSuite  (2007-08-21)
>http://python.org/sf/1778410  opened by  Mark Edgington
>
> robotparser.py fixes  (2007-08-21)
>http://python.org/sf/1778443  opened by  Indy
>
> Remove redundancies inside class logging.Logger  (2007-08-22)
>http://python.org/sf/1779550  opened by  Carsten Grohmann
>
> Replace AtheOS w/ Syllable  (2007-08-22)
>http://python.org/sf/1779613  opened by  Skip Montanaro
>
> Make python build with gcc-4.2 on OS X 10.4.9  (2007-08-23)
>http://python.org/sf/1779871  opened by  Jeffrey Yasskin
>
> Patches Closed
> __
>
> distutils.util.get_platform() return value on 64bit Windows  (2007-07-27)
>http://python.org/sf/1761786  closed by  mhammond
>
> MSVC6/7 issues with bdist_wininst and --target-version  (2004-07-01)
>http://python.org/sf/983164  closed by  mhammond
>
> Override flags set by IOBase in io.StringIO  (2007-08-15)
>http://python.org/sf/1774828  closed by  avassalotti
>
> Convert str to bytes in io.BytesIO.__init__  (2007-08-15)
>http://python.org/sf/1774833  closed by  avassalotti
>
> BufReader, TextReader for PEP 3116 "New I/O"  (2007-06-04)
>http://python.org/sf/1731036  closed by  gvanrossum
>
> utf-32 codecs  (2007-08-16)
>http://python.org/sf/1775604  closed by  gvanrossum
>
> Make it possible to use SVK to develop Python  (2007-08-14)
>http://python.org/sf/1774414  closed by  collinwinter
>
> New / Reopened Bugs
> ___
>
> memoryview('test') is causing a segfault  (2007-08-19)
> CLOSED http://python.org/sf/1777057  reopened by  tiran
>
> Please warn about a subtle trap  (2007-08-19)
> CLOSED http://python.org/sf/1777160  opened by  Greg Kochanski
>
> Confusing typography Python Ref 5.9  (2007-08-19)
> CLOSED http://python.org/sf/1777168  opened by  Greg Kochanski
>
> IDLE Freezes After Running Scripts  (2007-08-19)
>http://python.org/sf/1777398  opened by  Ross Peoples
>
> Python's strftime dislikes years before 1900  (2007-08-20)
>http://python.org/sf/1777412  opened by  Benno Rice
>
> glob doesn't return unicode with unicode parameter  (2007-08-20)
>http://python.org/sf/1777458  opened by  Grzegorz Adam Hankiewicz
>
> ctypes on Solaris  (2007-08-20)
>http://python.org/sf/1777530  opened by  Aki
>
> rounding inconsisntency using string formatting  (2007-08-20)
> CLOSED http://python.org/sf/1778207  opened by  Jim Hurlburt
>
> Segfault.  (2007-08-21)
>http://python.org/sf/1778376  opened by  Maciek Fijalkowski
>
> PyThreadState_SetAsyncExc and the main thread  (2007-08-22)
>http://python.org/sf/1779233  opened by  Rotem
>
> urlparse.urljoin does not obey current uri rfc (rfc 3986)  (2007-08-22)
>http://python.org/sf/1779700  opened by  John Adams
>
> Bugs Closed
> ___
>
> memoryview('test') is causing a segfault  (2007-08-18)
>http://python.org/sf/1777057  closed by  nnorwitz
>
> memoryview('test') is causing a segfault  (2007-08-18)
>http://python.org/sf/1777057  closed by  nnorwitz
>
> Please warn about a subtle trap  (2007-08-19)
>http://python.org/sf/1777160  closed by  gbrandl
>
> Confusing typography Python Ref 5.9  (2007-08-19)
>http://python.org/sf/1777168  closed by  gbrandl
>
> struni: str() doesn't call __str__() of subclasses of str  (2007-07-11)
>http://python.org/sf/1751598  closed by  tiran
>
> rounding inconsisntency using string formatting  (2007-08-21)
>http://python.org/sf/1778207  closed by  loewis
>
> mapitags.PROP_TAG() doesn't account for new longs  (2004-12-31)
>http://python.org/sf/1093389  closed by  mhammond
>
> Overenthusiastic check in Swap?  (2004-04-01)
>http://python.org/sf/926910  closed by  mhammond
>
> ___
> Python-Dev mailing list
> [email protected]
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: 
> http://mail.python.org/mailman/options/python-dev/brett%40python.org
>
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] New bug tracker is active now

2007-08-23 Thread Erik Forsberg
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

"Martin v. Löwis" <[EMAIL PROTECTED]> writes:

>> When editing my details I saw there is a field for my timezone.  The
>> comment says: "this is a numeric hour offset, the default is UTC", so
>> I'm assuming it counts in whole hours (fine for me, not so fine for
>> people in e.g. India, unless it accepts decimal notation).  I have two
>> issues with this: it's unclear which direction this works (is East
>> positive or negative?), and I will need to change this number twice
>> yearly.  In other words, it shouldn't be a number, it should be a name,
>> like the names used in Linux: Europe/Amsterdam.
>
> I think this will be fairly difficult to fix. Roundup doesn't have
> a timezone database; it just applies the delta to the UTC time. We are
> merely using roundup, instead of developing it.

Actually, there is some kind of symbolic time zone support via the
pytz module. If the pytz module is installed, you can provide the time
zone as a symbolic name. I don't know if it follows the DST changes.

I would suggest that someone enter a feature request in the meta
tracker, http://psf.upfronthosting.co.za/roundup/meta/, and we can
take a look.
>
> See
>
> http://sourceforge.net/tracker/index.php?func=detail&aid=818711&group_id=31577&atid=402791

Might be outdated. Could be a case of "sourceforge tracker is so hard
to use that you really don't want to use it". Yeah, it's kind of
ironic that roundup isn't running a roundup tracker..

Regards,
\EF
- -- 
Erik Forsberg http://efod.se
GPG/PGP Key: 1024D/0BAC89D9
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8+ 

iD8DBQFGzeilrJurFAusidkRAuxIAJ4xcm5m2/1u2X3zkdi99eAi2Ll+LwCgxoxc
MJ4mO+8my4mbnDv5L6eRRo0=
=bZog
-END PGP SIGNATURE-

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] uuid creation not thread-safe?

2007-08-23 Thread Guido van Rossum
This was now fixed in 3.0. Somebody might want to backport.

On 7/28/07, lcaamano <[EMAIL PROTECTED]> wrote:
>
> On Jul 20, 1:52 pm, "Guido van Rossum" <[EMAIL PROTECTED]> wrote:
> > I discovered what appears to be a thread-unsafety inuuid.py. This is
> > in the trunk as well as in 3.x; I'm using the trunk here for easy
> > reference. There's some code around like 395:
> >
> > import ctypes, ctypes.util
> > _buffer = ctypes.create_string_buffer(16)
> >
> > This creates a *global* buffer which is used as the output parameter
> > to later calls to _uuid_generate_random() and _uuid_generate_time().
> > For example, around line 481, in uuid1():
> >
> > _uuid_generate_time(_buffer)
> > returnUUID(bytes=_buffer.raw)
> >
> > Clearly if two threads do this simultaneously they are overwriting
> > _buffer in unpredictable order. There are a few other occurrences of
> > this too.
> >
> > I find it somewhat disturbing that what seems a fairly innocent
> > function that doesn't *appear* to have global state is nevertheless
> > not thread-safe. Would it be wise to fix this, e.g. by allocating a
> > fresh output buffer inside uuid1() and other callers?
> >
>
>
> I didn't find any reply to this, which is odd, so forgive me if it's
> old news.
>
> I agree with you that it's not thread safe and that a local buffer in
> the stack should fix it.
>
> Just for reference, the thread-safe uuid extension we've been using
> since python 2.1, which I don't recall where we borrow it from, uses a
> local buffer in the stack.  It looks like this:
>
> -begin uuid.c--
>
> static char uuid__doc__ [] =
> "DCE compatible Universally Unique Identifier module";
>
> #include "Python.h"
> #include 
>
> static char uuidgen__doc__ [] =
> "Create a new DCE compatible UUID value";
>
> static PyObject *
> uuidgen(void)
> {
> uuid_t out;
> char buf[48];
>
> uuid_generate(out);
> uuid_unparse(out, buf);
> return PyString_FromString(buf);
> }
>
> static PyMethodDef uuid_methods[] = {
> {"uuidgen", uuidgen, 0, uuidgen__doc__},
> {NULL,  NULL}/* Sentinel */
> };
>
> DL_EXPORT(void)
> inituuid(void)
> {
> Py_InitModule4("uuid",
>uuid_methods,
>uuid__doc__,
>(PyObject *)NULL,
>PYTHON_API_VERSION);
> }
>
> -end uuid.c--
>
>
> It also seems that using uuid_generate()/uuid_unparse() should be
> faster than using uuid_generate_random() and then creating a python
> object to call its __str__ method.  If so, it would be nice if the
> uuid.py module also provided equivalent fast versions that returned
> strings instead of objects.
>
>
> --
> Luis P Caamano
> Atlanta, GA, USA
>
>


-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com