GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Issue #4075: Use OutputDebugStringW in Py_FatalError. · yahalit/python@40fb890

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • Misc
    • NEWS
  • Python
    • pythonrun.c
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Misc/NEWS‎

Copy file name to clipboardExpand all lines: Misc/NEWS
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ What's New in Python 2.7 alpha 1
1212
Core and Builtins
1313
-----------------
1414

15+
- Issue #4075: Use OutputDebugStringW in Py_FatalError.
16+
1517
- Issue #4797: IOError.filename was not set when _fileio.FileIO failed to open
1618
file with `str' filename on Windows.
1719

Collapse file

‎Python/pythonrun.c‎

Copy file name to clipboardExpand all lines: Python/pythonrun.c
+17-3Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#include <signal.h>
2323
#endif
2424

25+
#include "malloc.h" /* for alloca */
26+
2527
#ifdef HAVE_LANGINFO_H
2628
#include <locale.h>
2729
#include <langinfo.h>
@@ -1628,9 +1630,21 @@ Py_FatalError(const char *msg)
16281630
{
16291631
fprintf(stderr, "Fatal Python error: %s\n", msg);
16301632
#ifdef MS_WINDOWS
1631-
OutputDebugString("Fatal Python error: ");
1632-
OutputDebugString(msg);
1633-
OutputDebugString("\n");
1633+
{
1634+
size_t len = strlen(msg);
1635+
WCHAR* buffer;
1636+
size_t i;
1637+
1638+
/* Convert the message to wchar_t. This uses a simple one-to-one
1639+
conversion, assuming that the this error message actually uses ASCII
1640+
only. If this ceases to be true, we will have to convert. */
1641+
buffer = alloca( (len+1) * (sizeof *buffer));
1642+
for( i=0; i<=len; ++i)
1643+
buffer[i] = msg[i];
1644+
OutputDebugStringW(L"Fatal Python error: ");
1645+
OutputDebugStringW(buffer);
1646+
OutputDebugStringW(L"\n");
1647+
}
16341648
#ifdef _DEBUG
16351649
DebugBreak();
16361650
#endif

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.