[Python-Dev] Python 2.5.1

2007-04-27 Thread Khalid A. Bakr
Hello


I downloaded Python's 2.5.1 (final) bz2 source archive
the other day to try to compile it in MinGW. I have
noted down the following observations that might be of
interest.

1. The bz2 archive ships with
\Modules\collectionsmodule.c instead of the
\Modules\_collectionsmodule.c used in the 2.5 SVN
branch. In fact the collectionsmodule.c was removed
some time ago.

2. If _collectionsmodule.c is the one to be used in
branch and source then it follows that \PC\config.c
needs an update.

3. test_1686475 of test_os appears to rely on the
existence of "c:\pagefile.sys" like so:

def test_1686475(self):
# Verify that an open file can be stat'ed
try:
os.stat(r"c:\pagefile.sys")
except WindowsError, e:
if e == 2: # file does not exist;
cannot run test
return
self.fail("Could not stat
pagefile.sys")


But since that file does not appear to be in my C
drive and since the Windows error returned is not a
numeric, but rather a string of the sort: "[Error 5]
Access is denied: 'c:\\pagefile.sys'" then that test
fails for me both in the MinGW compiled Python and in
the officially distributed one.

4. Also test_1565150 of test_os which reads as
follows:

# Restrict test to Win32, since there is no
guarantee other
# systems support centiseconds
if sys.platform == 'win32':
def test_1565150(self):
t1 = 1159195039.25
os.utime(self.fname, (t1, t1))
   
self.assertEquals(os.stat(self.fname).st_mtime, t1)


fails in the MinGW compiled Python with the following
message:

==
FAIL: test_1565150 (test.test_os.StatAttributeTests)
--
Traceback (most recent call last):
  File "G:\projs\py25\python\r25\lib\test\test_os.py",
line 241, in test_1565150

self.assertEquals(os.stat(self.fname).st_mtime,
t1)
AssertionError: 1159195040 != 1159195039.25



If the same test passes in the official CPython on the
same machine (and it does), can it then be deduced
that this is not a system's issue but a compiler one?


Thanks
Khalid

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] whitespace normalization

2007-04-27 Thread skip

> Just a little FYI, python-mode (the one Barry and I manage - dunno
> about the one distributed w/ GNU Emacs these days) is one of those
> tools that leaves trailing whitespace behind when advancing to the
> next line..

Okay, I figured this out.  The dangling whitespace turds are caused by LF or
RET followed by a regular cursor motion keypress (e.g. C-n or the arrow
keys) which move the cursor away from that line.  Those commands operate
outside python-mode's control there so it doesn't get the opportunity to
remove the whitespace before moving the cursor.  XEmacs (at least) doesn't
have a cursor-motion-hook so there's no clean way to do this.

I've been using Emacs for so many years that my central control program long
ago pushed out most of the basic cursor motion control code to ganglia which
reside in my wrists.  The channel is full duplex but highly assymetric.  The
upload speed is very slow.  It thus takes a couple days to realize in my
frontal cortex how this low level stuff works...

Skip

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


[Python-Dev] New operations in Decimal

2007-04-27 Thread Facundo Batista

The following are the new operations in the decimal module that we'll
be available according to the last published specification.

I wrote here the proposed name by me, the original name between
parenthesis, where it will be located between square brackets (C for
context and D for the decimal object itself), and a small description
of the operation (I specially trimmed the verbose special cases from
the description, if you want an exact explanation of what does each,
read the spec).

Note that always it says how many operands it takes. The number
implies you're calling it through the context. If called through
Decimal, you have to substract one from it (as the first operand will
be the number itself in this case).

Enjoy it, and any feedback is very appreciated, :)


- compare_signal (compare–signal) [CD]: Takes two operands and
  compares their values numerically (pretty much like compare(), but all
  NaNs signal, with signaling NaNs taking precedence over quiet NaNs. 

- fma (fused-multiply-add) [C]: Takes three operands; the first two are
  multiplied together, using multiply, the third operand is then added
  to the result of that multiplication, using add, all with only one
  final rounding.

- ln (ln) [CD]: Takes one operand, and the result is the natural (base
  e) logarithm of the operand.

- log10 (log10) [CD]: Takes one operand, and the result is the base 10
  logarithm of the operand.

- max_mag (max–magnitude), and min_mag (min-magnitude) [CD]: Takes two
  operands and compares their values numerically with their sign
  ignored. 

- next_minus (next–minus) [CD]: Takes one operand and the result is the
  largest representable number that is smaller than the operand.

- next_plus (next–plus) [CD]: Takes one operand and the result is the
  smallest representable number that is larger than the operand.

- next_toward (next–toward) [CD]: Takes two operands and the result is
  the representable number closest to the first operand (but not the
  first operand) that is in the direction towards the second operand,
  unless the operands have the same value.

- to_integral_exact (round-to-integral-exact) [C]: Takes one operand. It
  is similar to the round–to–integral–value (the old to_integral), with
  the difference the now Inexact and Rounded flags are allowed in the
  result.


The following operations appear in a new section of the specification
called "Miscelaneous Operations". Between these are logical
operations that take logical operands, which are finite positive
non-exponent numbers with a coefficient whose digits must all be either
0 or 1.

- and (and), or (or), xor (xor) [CD]: Takes two logical operands, the
  result is the logical operation applied between each digit.

- canonical (canonical) [CD]: Canonical takes one operand, returns the
  same Decimal object, as we do not have different encodings for the
  same number.

- number_class (class) [CD]: Takes one operando, returns an indication
  of the class of the operand, where the class is one of the following:
  "sNaN", "NaN", "–Infinity", "–Normal", "–Subnormal", "–Zero", "+Zero",
  "+Subnormal", "+Normal" or "+Infinity".

- compare_total (compare–total) [CD]: Takes two operands and compares
  them using their abstract representation rather than their numerical
  value (a total ordering is defined for all possible abstract
  representations).

- compare_total_mag (compare–total–magnitude) [CD]: Takes two operands
  and compares them using their abstract representation rather than
  their numerical value, with their sign ignored and assumed to be 0.

- copy_abs (copy-abs) [CD]: Takes one operand, returns a copy of it
  with the sign set to 0.

- copy_negate (copy-negate) [CD]: Takes one operand, returns a copy of
  it with the sign inverted.

- copy_sign (copy–sign) [CD]: Takes two operands, returns a copy of the
  first operand with the sign equal to the sign of the second operand.

- invert (invert) [CD]: Takes one logical operand, the result is the
  digit-wise inversion of the operand. 

- is-canonical (is–canonical) [CD]: Takes one operand, returns 1 if the
  operand is canonical; otherwise returns 0. 

- is_finite (is–finite) [CD]: Takes one operand, returns 1 if the
  operand is neither infinite nor a NaN, otherwise returns 0. 

- is_infinite (is–infinite) [CD]: Takes one operand, returns 1 if the
  operand is an Infinite, otherwise returns 0. 

- is_nan (is–NaN) [CD]: Takes one operand, returns 1 if the operand is
  a quiet or signaling NaN, otherwise returns 0. 

- is_normal (is–normal) [CD]: Takes one operand, returns 1 if the
  operand is a positive or negative normal number, otherwise returns 0. 

- is_qnan (is–qNaN) [CD]: Takes one operand, returns 1 if the operand
  is a quiet NaN, otherwise returns 0. 

- is_signed (is–signed) [CD]: Takes one operand, returns 1 if the sign
  of the operand is 1, otherwise returns 0. 

- is_snan (is–sNaN) [CD]: Takes one operand, returns 1 if the operand
  is a signaling NaN, otherwise retur

Re: [Python-Dev] Python 2.5.1

2007-04-27 Thread Martin v. Löwis
Khalid A. Bakr schrieb:
> 1. The bz2 archive ships with
> \Modules\collectionsmodule.c instead of the
> \Modules\_collectionsmodule.c used in the 2.5 SVN
> branch. In fact the collectionsmodule.c was removed
> some time ago.

Why do you say that?

http://svn.python.org/projects/python/branches/release25-maint/Modules/collectionsmodule.c

is still present AFAICT.

> 2. If _collectionsmodule.c is the one to be used in
> branch and source then it follows that \PC\config.c
> needs an update.

But it isn't the one to be used.

> But since that file does not appear to be in my C
> drive and since the Windows error returned is not a
> numeric, but rather a string of the sort: "[Error 5]
> Access is denied: 'c:\\pagefile.sys'" then that test
> fails for me both in the MinGW compiled Python and in
> the officially distributed one.

That's true. Can you come up with a patch? Looking
at the error code of the exception should be sufficient;
it should be 5 (as the message shows). The exception
is *not* a string, but an object.

> 4. Also test_1565150 of test_os which reads as
> follows:
[...]
> fails in the MinGW compiled Python with the following
> message:
> 
> ==
> FAIL: test_1565150 (test.test_os.StatAttributeTests)
> --
> Traceback (most recent call last):
>   File "G:\projs\py25\python\r25\lib\test\test_os.py",
> line 241, in test_1565150
> 
> self.assertEquals(os.stat(self.fname).st_mtime,
> t1)
> AssertionError: 1159195040 != 1159195039.25

That would indicate a bug in the MingW port.

> If the same test passes in the official CPython on the
> same machine (and it does), can it then be deduced
> that this is not a system's issue but a compiler one?

Likely, neither nor. My guess is that the MingW port,
for some reason, decides not to use the Win32 API to
perform stat, but the C library. That is incorrect,
as the C library will perform truncation of subsecond
time stamps. The compiler itself should have no effect
(other than defining different compiler recognition
macros).

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


[Python-Dev] Weekly Python Patch/Bug Summary

2007-04-27 Thread Kurt B. Kaiser
Patch / Bug Summary
___

Patches :  356 open ( -1) /  3756 closed (+11) /  4112 total (+10)
Bugs:  968 open (+10) /  6673 closed (+16) /  7641 total (+26)
RFE :  254 open ( +3) /   282 closed ( +2) /   536 total ( +5)

New / Reopened Patches
__

fixes bug #1703952 - ctypes: problem with large integers  (2007-04-19)
CLOSED http://python.org/sf/1703972  opened by  Alexander Belopolsky

minidom Level 1 DOM compliance  (2007-04-20)
   http://python.org/sf/1704134  opened by  Jason Orendorff

textwrap.py mod. for jython  (2007-04-20)
CLOSED http://python.org/sf/1704473  opened by  Tim Couper

test_optparse.py mod. for jython  (2007-04-20)
   http://python.org/sf/1704474  opened by  Tim Couper

Use MoveFileEx() to implement os.rename() on windows  (2007-04-20)
   http://python.org/sf/1704547  opened by  Raghuram Devarakonda

interpreter crash when multiplying large lists  (2007-04-20)
   http://python.org/sf/1704621  opened by  Daniel Stutzbach

Added clearerr() to clear EOF state  (2007-04-23)
   http://python.org/sf/1706039  opened by  jos

Updated ASTVisitor Classes  (2007-04-24)
   http://python.org/sf/1706323  opened by  Yaakov Nemoy

Implementation of @abstractmethod for PEP 3119  (2007-04-24)
   http://python.org/sf/1706989  opened by  Guido van Rossum

get status output fix for Win32  (2007-04-25)
   http://python.org/sf/1707753  opened by  Ken Phillis Jr.

Make isinstance/issubclass overloadable  (2007-04-26)
   http://python.org/sf/1708353  opened by  Guido van Rossum

Patches Closed
__

silenced a compiler warning  (2007-04-18)
   http://python.org/sf/1703268  closed by  nnorwitz

missing declaration in readline.c  (2007-04-18)
   http://python.org/sf/1703270  closed by  nnorwitz

ZipFile.printdir fix (2.5)  (2007-04-11)
   http://python.org/sf/1698915  closed by  nnorwitz

Migrate test_minidom.py to unittest  (2007-03-30)
   http://python.org/sf/1691032  closed by  jorend

fixes bug #1703952 - ctypes: problem with large integers  (2007-04-20)
   http://python.org/sf/1703972  closed by  theller

Update to Macintosh library documentation  (2007-04-11)
   http://python.org/sf/1698768  closed by  gbrandl

textwrap.py mod. for jython  (2007-04-20)
   http://python.org/sf/1704473  closed by  gbrandl

tarfile bug when opening a file directly  (2007-04-05)
   http://python.org/sf/1695229  closed by  gustaebel

stream writing support in wave.py  (2007-02-05)
   http://python.org/sf/1652328  closed by  nnorwitz

PEP 3114 -- next() -> __next__()  (2007-03-07)
   http://python.org/sf/1675363  closed by  gbrandl

warnings.py gets filename wrong for eval/exec  (2007-04-01)
   http://python.org/sf/1692664  closed by  nnorwitz

New / Reopened Bugs
___

"t.join(); assert t not in threading.enumerate()" fails  (2007-04-19)
   http://python.org/sf/1703448  opened by  Andrew Bennetts

have a way to ignore nonexisting locales in locale.setlocale  (2007-04-19)
   http://python.org/sf/1703592  opened by  Matthias Klose

ctypes: problem with large integers  (2007-04-19)
   http://python.org/sf/1703952  reopened by  belopolsky

ctypes: problem with large integers  (2007-04-19)
   http://python.org/sf/1703952  opened by  Alexander Belopolsky

TarFile.addfile() throws a struct.error  (2007-04-20)
CLOSED http://python.org/sf/1704156  opened by  K. C. Wong

must run "make" before "make install"  (2007-04-20)
   http://python.org/sf/1704287  opened by  Joseph VanAndel

Exception message when using subprocess.POpen  (2007-04-21)
CLOSED http://python.org/sf/1704790  opened by  Sam Ruby

incorrect return value of unicodedata.lookup() - beoynd BMP  (2007-04-21)
   http://python.org/sf/1704793  opened by  vbr

contextmanager eats StopIteration  (2007-04-22)
   http://python.org/sf/1705170  opened by  Adam Olsen

cannot change cursor color in IDLE   (2007-04-22)
   http://python.org/sf/1705362  opened by  zorkin

'nonlocal x' at top level crashes interpreter  (2007-04-22)
CLOSED http://python.org/sf/1705365  opened by  John Reese

Select() failure (race condition)  (2007-04-22)
   http://python.org/sf/1705393  opened by  Ron Garret

Error in sys.argv documenation  (2007-04-23)
CLOSED http://python.org/sf/1705717  opened by  Kamil Kisiel

pydoc.py has typo.  (2007-04-23)
CLOSED http://python.org/sf/1705997  opened by  charlesmchen

SWIG options not being followed in all cases  (2007-04-24)
CLOSED http://python.org/sf/1706381  opened by  Morten Lied Johansen

socket.error exceptions not subclass of StandardError  (2007-04-24)
   http://python.org/sf/1706815  opened by  John Nagle

tarfile fails in 2.5.1 (NoneType has no ...)  (2007-04-24)
CLOSED http://python.org/sf/1706850  opened by  Thomas Leonard

Failed to build Python 2.5.1 with sqlite3  (2007-04-24)
   http://python.org/sf/1706863  opened by  Vitaliy Yermolenko

lost global variables in m

[Python-Dev] Python 2.5.1

2007-04-27 Thread Khalid A. Bakr

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

> Khalid A. Bakr schrieb:
> > 1. The bz2 archive ships with
> > \Modules\collectionsmodule.c instead of the
> > \Modules\_collectionsmodule.c used in the 2.5 SVN
> > branch. In fact the collectionsmodule.c was
> removed
> > some time ago.
> 
> Why do you say that?
> 
>
http://svn.python.org/projects/python/branches/release25-maint/Modules/collectionsmodule.c
> 
> is still present AFAICT.
> 
> > 2. If _collectionsmodule.c is the one to be used
> in
> > branch and source then it follows that
> \PC\config.c
> > needs an update.
> 
> But it isn't the one to be used.


I am sorry. Me repository seems corrupted. Doing a
clean check out of the 2.5 branch as I write this.


> That's true. Can you come up with a patch? Looking
> at the error code of the exception should be
> sufficient;
> it should be 5 (as the message shows). The exception
> is *not* a string, but an object.


Okay. It seems I mixed up WindowsError with the
exception e in my post; at least it is now known that
e is not a number. The patch is short and is as
follows:

Index: Lib/test/test_os.py
===
--- Lib/test/test_os.py (revision 55014)
+++ Lib/test/test_os.py (working copy)
@@ -245,7 +245,8 @@
 try:
 os.stat(r"c:\pagefile.sys")
 except WindowsError, e:
-if e == 2: # file does not exist;
cannot run test
+# file may not exist, or access is
denied; cannot run test
+if e.winerror == 2 or e.winerror ==
5:
 return
 self.fail("Could not stat
pagefile.sys")



Or do I need to submit this through sourceforge?


> That would indicate a bug in the MingW port.
>
> > If the same test passes in the official CPython on
> the
> > same machine (and it does), can it then be deduced
> > that this is not a system's issue but a compiler
> one?
> 
> Likely, neither nor. My guess is that the MingW
> port,
> for some reason, decides not to use the Win32 API to
> perform stat, but the C library. That is incorrect,
> as the C library will perform truncation of
> subsecond
> time stamps. The compiler itself should have no
> effect
> (other than defining different compiler recognition
> macros).
> 
> Regards,
> Martin
> 


I will try to check what can be done about this.

Regards,
Khalid

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Python 2.5.1

2007-04-27 Thread Martin v. Löwis
> Or do I need to submit this through sourceforge?

Please do. Why are you checking for error 2, though,
if the error that occurs is 5?

Regards,
Martin

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


Re: [Python-Dev] Python 2.5.1

2007-04-27 Thread Khalid A. Bakr

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

> > Or do I need to submit this through sourceforge?
> 
> Please do. Why are you checking for error 2, though,
> if the error that occurs is 5?
> 
> Regards,
> Martin
> 
> 


Done. I was just correcting the previous posted check
for error 2; I thought it must have been there for a
reason I don't know. Anyway, this part is now removed
from patch, which is at: http://python.org/sf/1709112

Regards,
Khalid

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com