473,385 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

fputs in tp_print crashes under Win32

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
Nov 12 '08 #1
1 2103
En Wed, 12 Nov 2008 08:58:05 -0200, Petr Gotthard
<pe***********@centrum.czescribió:
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

Nov 15 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Pekka Karjalainen | last post by:
I'm using WinXP (Finnish), Python 2.4.1 (#65, Mar 30 2005, 09:13:57) on win32 and wxPython 2.6.0.1. When I go to the Process and Events section in the wxDemo and run the Process demo, bad things...
2
by: hokus | last post by:
Why when I attemp to allocate 4.8E8 bytes of memory my WinApi application crashes? How to resolve this problem? By the way std::vector<char>::reserve(480000000) crashes too. Thanks
145
by: Sidney Cadot | last post by:
Hi all, In a discussion with Tak-Shing Chan the question came up whether the as-if rule can cover I/O functions. Basically, he maintains it can, and I think it doesn't. Consider two...
19
by: Nak | last post by:
Hi there, *fingers crossed that the newsserver works long enough for me to see any replies to this!!* I'm having crashes when using SndPlaySound with SND_ASYNC and SND_MEMORY in VB.NET. The...
3
by: TheSebaster | last post by:
I register to a com event under a win32 C# application. Here is the code I wrote: InstrumentUX.StorageControl pStorageControl = null; pStorageControl =...
1
by: ropo | last post by:
I am using .NET 2.0 I have a C#.Net App, which uses a .NET Class Library, which accesses a COM object through interop. The C#.Net App also uses a mixed mode C++.Net Class library which uses an...
1
by: rajayan | last post by:
Jochen Kalmbach wrote: Thank you for your reply. Yes we do. Could you please elaborate. Are you referring to the CString::AllocBuffer related hangs or sudden crashes --
27
by: Chad | last post by:
Why doesn't fputs() write the null byte when the null-terminted string is written to a stream? I don't see the reasoning behind this. Chad
5
by: matt | last post by:
This is a strange one but I've been stuck on it for days. Any help appreciated. THE PLAN: I've a database that I use a script to grab all the entries for a particular field. I then want to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.