[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


[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 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


Re: [Python-Dev] Python 2.5.1

2007-04-28 Thread Khalid A. Bakr
--- "Martin v. Löwis" <[EMAIL PROTECTED]> wrote:
> There must be more to the problem than just an open
> file. Please undo the change that triggered the 
> addition of the test, and see whether you
> can reproduce the original problem with an arbitrary
> open file (I
> could trigger the problem with pagefile.sys at the 
> time).
>
> Regards,
> Martin

--- "Calvin Spealman"  wrote:
> I'm sorry, but somehow I could not parse this. My 
> understanding was that the unittest was meant to 
> make sure an os.stat call would be successful on an
> open file, and that pagefile.sys was >simply used as
> a known open file, which is no longer correct. If 
> that is the case, I am unsure what problem there is
> with >my fix of a temporary open file to test upon


I think the point is that the problem should be solved
(stat of open file) for any arbitrary open file
including pagefile.sys.

After booting into Win98, I can see that I have a
pagefile.sys indeed in my C drive which WinXP hides
from view. While in Win98 and with the file not in
use, the test passes on Win98 when looking for
pagefile.sys in C drive (no complaint about file not
found or access denied, even though I know that the
file is not open). And the test passes for the running
python.exe that is processing the test.

After some googling it seems to me that this could
likely be a User Rights Assignment issue of a systems
file not an open file stat one, hence the Access
denied error message (winerror 5) that I got in WinXP,
as opposed to the File not found windows error
(winerror 2) which one might expect if the
pagefile.sys did not exist. 

And therefore if the point of the test is just to test
stating an open file then the temporary file approach
makes sense. If modifying a systems file with or
without User Rights Assignment is a requirement then
we may need a new test altogether.

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


[Python-Dev] Python 2.5.1

2007-04-28 Thread Khalid A. Bakr
For reference, this is the result of running the
regression tests of the official Python 2.5.1 (final)
on Win98. I think I saw it in the installtion screen
that Python 2.5 is the last release to support Win98. 

Even though the unicode tests failing might be
expected, what interested me was the fact that
test_1565150 of test_os failed. Details follow.



259 tests OK.
8 tests failed:
test_anydbm test_bsddb test_mailbox test_os 
test_shelve test_unicode_file test_uuid 
test_whichdb
54 tests skipped:
test__locale test_aepack test_al test_applesingle 
test_bsddb185 test_bsddb3 test_cd test_cl 
test_codecmaps_cn test_codecmaps_hk
test_codecmaps_jp test_codecmaps_kr 
test_codecmaps_tw test_commands test_crypt 
test_curses test_dbm test_dl test_fcntl
test_fork1 test_gdbm test_gl test_grp test_imgfile

test_ioctl test_largefile test_linuxaudiodev 
test_macfs test_macostools test_mhlib test_nis 
test_normalization test_openpty test_ossaudiodev 
test_pep277 test_plistlib test_poll test_posix
test_pty test_pwd test_resource 
test_scriptpackages test_signal test_socket_ssl 
test_socketserver test_sunaudiodev test_tcl
test_threadsignals test_timeout test_urllib2net 
test_urllibnet test_wait3 test_wait4
test_zipfile64
1 skip unexpected on win32:
test_tcl
find_library('c') ->  None
find_library('m') ->  None
a DOS box should flash briefly ...



$ python -i
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC
v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for
more information.
>>> from test import test_os as t
>>> t.test_main()
test_access (test.test_os.FileTests) ... ok
test_tempnam (test.test_os.TemporaryFileTests) ... ok
test_tmpfile (test.test_os.TemporaryFileTests) ... ok
test_tmpnam (test.test_os.TemporaryFileTests) ... ok
test_1565150 (test.test_os.StatAttributeTests) ...
FAIL
test_1686475 (test.test_os.StatAttributeTests) ... ok
test_stat_attributes (test.test_os.StatAttributeTests)
... ok
test_statvfs_attributes
(test.test_os.StatAttributeTests) ... ok
test_bool (test.test_os.EnvironTests) ... ok
test_constructor (test.test_os.EnvironTests) ... ok
test_get (test.test_os.EnvironTests) ... ok
test_getitem (test.test_os.EnvironTests) ... ok
test_items (test.test_os.EnvironTests) ... ok
test_keys (test.test_os.EnvironTests) ... ok
test_len (test.test_os.EnvironTests) ... ok
test_pop (test.test_os.EnvironTests) ... ok
test_popitem (test.test_os.EnvironTests) ... ok
test_read (test.test_os.EnvironTests) ... ok
test_setdefault (test.test_os.EnvironTests) ... ok
test_update (test.test_os.EnvironTests) ... ok
test_update2 (test.test_os.EnvironTests) ... ok
test_values (test.test_os.EnvironTests) ... ok
test_write (test.test_os.EnvironTests) ... ok
test_traversal (test.test_os.WalkTests) ... ok
test_makedir (test.test_os.MakedirTests) ... ok
test_devnull (test.test_os.DevNullTests) ... ok
test_urandom (test.test_os.URandomTests) ... ok
test_access (test.test_os.Win32ErrorTests) ... ok
test_chdir (test.test_os.Win32ErrorTests) ... ok
test_chmod (test.test_os.Win32ErrorTests) ... ok
test_mkdir (test.test_os.Win32ErrorTests) ... ok
test_remove (test.test_os.Win32ErrorTests) ... ok
test_rename (test.test_os.Win32ErrorTests) ... ok
test_utime (test.test_os.Win32ErrorTests) ... ok

==
FAIL: test_1565150 (test.test_os.StatAttributeTests)
--
Traceback (most recent call last):
  File "G:\GMISC\PY25\lib\test\test_os.py", line 232,
in test_1565150
self.assertEquals(os.stat(self.fname).st_mtime,
t1)
AssertionError: 1159195040.0 != 1159195039.25

--
Ran 34 tests in 0.440s

FAILED (failures=1)
Traceback (most recent call last):
  File "", line 1, in 
  File "G:\GMISC\PY25\lib\test\test_os.py", line 434,
in test_main
Win32ErrorTests
  File "G:\GMISC\PY25\lib\test\test_support.py", line
441, in run_unittest
run_suite(suite, testclass)
  File "G:\GMISC\PY25\lib\test\test_support.py", line
426, in run_suite
raise TestFailed(err)
test.test_support.TestFailed: Traceback (most recent
call last):
  File "G:\GMISC\PY25\lib\test\test_os.py", line 232,
in test_1565150
self.assertEquals(os.stat(self.fname).st_mtime,
t1)
AssertionError: 1159195040.0 != 1159195039.25

>>> 
>>> 
>>> 


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


[Python-Dev] Python 2.5.1

2007-04-29 Thread Khalid A. Bakr
All test_os tests pass for me now on WinXP under
MinGW. Please see http://.python.org/sf/1709112
for details and patches.


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