[issue6600] MemoryError in AiX 64-bit build - PyMem_MALLOC failed

2009-08-05 Thread Sridhar Ratnakumar

Sridhar Ratnakumar  added the comment:

It does appear that this problem occurs wherever `strlen` is used .. 
and given that strlen is a macro on AIX, I suspect the problem is with 
the macro definition itself.

I will see if wrapping the arguments to PyMem_MALLOC in parenthesis 
would help. And/or investigate the problem further.

As for your belief that it might be a compiler bug, I will wait till 
investigating the actual cause of the problem before drawing any 
conclusions. Till then, there is no reason to commit the current 
(experimental/workaround) patches to Python.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6600] MemoryError in AiX 64-bit build - PyMem_MALLOC failed

2009-08-05 Thread Sridhar Ratnakumar

Sridhar Ratnakumar  added the comment:

Update: posixmodule.c too has the same problem. Attaching similar patch 
for this:

--- python/Modules/posixmodule.c.orig   2009-08-05 09:47:07.0 
-0700
+++ python/Modules/posixmodule.c2009-08-05 09:48:46.0 
-0700
@@ -6451,7 +6451,7 @@
return NULL;
 
/* Sanitize mode.  See fileobject.c */
-   mode = PyMem_MALLOC(strlen(orgmode)+3);
+   mode = PyMem_MALLOC(3+strlen(orgmode));

--
keywords: +patch
Added file: http://bugs.python.org/file14662/aix2.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6600] MemoryError in AiX 64-bit build - PyMem_MALLOC failed

2009-08-05 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

If your patch really fixes the issue, it is probably a compiler problem.
Does IBM have a user group or support line to which you can take this?

--
nosy: +pitrou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6600] MemoryError in AiX 64-bit build - PyMem_MALLOC failed

2009-07-30 Thread Sridhar Ratnakumar

Sridhar Ratnakumar  added the comment:

Forget the last comment, the patch is still valid and without it python 
gives MemoryError.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6600] MemoryError in AiX 64-bit build - PyMem_MALLOC failed

2009-07-30 Thread Sridhar Ratnakumar

Sridhar Ratnakumar  added the comment:

Damn, now even the original code (without the patch) works. This is an 
unreliable issue.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6600] MemoryError in AiX 64-bit build - PyMem_MALLOC failed

2009-07-30 Thread Sridhar Ratnakumar

Sridhar Ratnakumar  added the comment:

This is after preprocessor run (cc_r -E):-

Original:
newmode = (((__strlen(mode) + 3) < 0 || (__strlen(mode) + 3) > 
((Py_ssize_t)(((size_t)-1)>>1))) ? 0 : malloc((__strlen(mode) + 3) ? 
(__strlen(mode) + 3) : 1));

Patched:
newmode = (((3 + __strlen(mode)) < 0 || (3 + __strlen(mode)) > 
((Py_ssize_t)(((size_t)-1)>>1))) ? 0 : malloc((3 + __strlen(mode)) ? (3 
+ __strlen(mode)) : 1));

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6600] MemoryError in AiX 64-bit build - PyMem_MALLOC failed

2009-07-30 Thread Sridhar Ratnakumar

Changes by Sridhar Ratnakumar :


--
components: +Interpreter Core -Build, IO
title: MemoryError in AiX 64-bit build -> MemoryError in AiX 64-bit build - 
PyMem_MALLOC failed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6600] MemoryError in AiX 64-bit build

2009-07-29 Thread Sridhar Ratnakumar

Sridhar Ratnakumar  added the comment:

This is strange .. the attached patch (reverses operands to +) fixes 
the issue.

--
Added file: http://bugs.python.org/file14605/patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6600] MemoryError in AiX 64-bit build

2009-07-29 Thread Sridhar Ratnakumar

Sridhar Ratnakumar  added the comment:

Interesting. If add the line:

  newmode = PyMem_MALLOC(4);

next to the existing line:

  newmode = PyMem_MALLOC(strlen(mode) + 3);

there is no MemoryError!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6600] MemoryError in AiX 64-bit build

2009-07-29 Thread Sridhar Ratnakumar

Sridhar Ratnakumar  added the comment:

I localized the error to line 248 in http://svn.python.org/view/python/
branches/release26-maint/Objects/fileobject.c?annotate=68135#248 
(brandl's change made 3 years ago)

  static PyObject *
  open_the_file(PyFileObject *f, char *name, char *mode)
  {
  [...]
/* probably need to replace 'U' by 'rb' */
newmode = PyMem_MALLOC(strlen(mode) + 3);
if (!newmode) {
  PyErr_NoMemory();
  return NULL;
}

--
nosy: +georg.brandl

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6600] MemoryError in AiX 64-bit build

2009-07-29 Thread Sridhar Ratnakumar

Sridhar Ratnakumar  added the comment:

I suspect this is related to http://mail.python.org/pipermail/python-
bugs-list/2003-November/021158.html

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6600] MemoryError in AiX 64-bit build

2009-07-29 Thread Sridhar Ratnakumar

New submission from Sridhar Ratnakumar :

(currently investigating the root cause of this issue...)

bash-2.04$ build/py2_6_2-aix5-powerpc-apy26-rrun/python/python -c "open
('/tmp/test', 'w')"
Traceback (most recent call last):
  File "", line 1, in 
MemoryError

bash-2.04$ build/py2_6_2-aix5-powerpc-apy26-rrun/python/python -c 
"import platform; print platform.uname()"
('AIX', 'asaixv5152', '1', '5', '000C763E4C00', 'powerpc')

bash-2.04$ file build/py2_6_2-aix5-powerpc-apy26-rrun/python/python 
build/py2_6_2-aix5-powerpc-apy26-rrun/python/python:64-bit XCOFF 
executable or object module not stripped

--
components: Build, IO
messages: 91076
nosy: srid
severity: normal
status: open
title: MemoryError in AiX 64-bit build
type: crash
versions: Python 2.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com