Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > fputs in tp_print crashes under Win32

Reply
Thread Tools

fputs in tp_print crashes under Win32

 
 
Petr Gotthard
Guest
Posts: n/a
 
      11-12-2008
Hello,
my C++ extension crashes under Win32 when the tp_print is called.

It crashes with both Python 2.5.2 and 2.6. The crash occurs in
system32\ntdll.dll, with exception code 0xc0000005.

I found out that this works fine:

int ulonghandle_print(RtiULongHandleObject *v, FILE *fp, int flags)
{
fputc('c', stdout);
return 0;
}

But this causes the error:

int ulonghandle_print(RtiULongHandleObject *v, FILE *fp, int flags)
{
fputc('c', fp); // <-- "fp" instead of "stdout"
return 0;
}

It occurs under Windows (XP SP2) only. Under Linux everything works
fine.


Do you have any idea what could be wrong?

Thanks,
Petr
 
Reply With Quote
 
 
 
 
Gabriel Genellina
Guest
Posts: n/a
 
      11-15-2008
En Wed, 12 Nov 2008 08:58:05 -0200, Petr Gotthard
<(E-Mail Removed)> escribió:

> Hello,
> my C++ extension crashes under Win32 when the tp_print is called.
>
> It crashes with both Python 2.5.2 and 2.6. The crash occurs in
> system32\ntdll.dll, with exception code 0xc0000005.
>
> I found out that this works fine:
>
> int ulonghandle_print(RtiULongHandleObject *v, FILE *fp, int flags)
> {
> fputc('c', stdout);
> return 0;
> }
>
> But this causes the error:
>
> int ulonghandle_print(RtiULongHandleObject *v, FILE *fp, int flags)
> {
> fputc('c', fp); // <-- "fp" instead of "stdout"
> return 0;
> }
>
> It occurs under Windows (XP SP2) only. Under Linux everything works
> fine.


Short answer: compile your extension with the *same* compiler used to
compile Python itself: Visual Studio 2008 for 2.6, Visual Studio .NET 2003
for 2.5
For the long answer search http://wiki.python.org/moin/

--
Gabriel Genellina

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
fputs hassan Python 1 06-05-2012 03:38 PM
fputs and fprintf _JusSx_ C Programming 10 02-28-2010 03:02 PM
A question about fputs() Chad C Programming 17 06-23-2008 08:44 PM
seek and fgets and fputs fopen dave C++ 4 11-02-2006 10:10 PM
Problem in Writing into the file..using fputs() call xoinki C Programming 1 05-02-2006 01:14 PM



Advertisments