Skip to content

Commit 84840f8

Browse files
committed
Fix win32 incompatibility
1 parent c2e98b6 commit 84840f8

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

libparse/py_iostream.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "Python.h"
33

44
#include <cstdio>
5+
#include <exception>
56
#include <iostream>
67
#include <locale>
78

@@ -74,7 +75,7 @@ template <class _CharT> void stdio_filebuf<_CharT>::imbue(const std::locale &__l
7475
__encoding_ = __cv_->encoding();
7576
__always_noconv_ = __cv_->always_noconv();
7677
if (__encoding_ > __limit)
77-
std::__throw_runtime_error("unsupported locale for standard io");
78+
throw std::runtime_error("unsupported locale for standard io");
7879
}
7980
template <class _CharT> typename stdio_filebuf<_CharT>::int_type stdio_filebuf<_CharT>::underflow() { return __getchar(false); }
8081
template <class _CharT> typename stdio_filebuf<_CharT>::int_type stdio_filebuf<_CharT>::uflow() { return __getchar(true); }

setup.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
#!/usr/bin/env python3
22
import os
3+
import platform
34
import subprocess
4-
from setuptools import setup, find_packages, Extension
5+
from setuptools import setup, Extension
56
from setuptools.command.build_py import build_py as _build_py
67

78
module_name = "libparse"
89
__dir__ = os.path.dirname(os.path.abspath(__file__))
910

11+
compiler_opts = ["-std=c++11", "-DFILTERLIB"]
12+
if platform.system() == "Windows":
13+
compiler_opts = ["/DFILTERLIB"]
14+
1015
ext = Extension(
1116
name="_libparse",
1217
swig_opts=["-c++"],
@@ -17,7 +22,7 @@
1722
include_dirs=[
1823
"libparse",
1924
],
20-
extra_compile_args=["-std=c++11", "-DFILTERLIB"],
25+
extra_compile_args=compiler_opts,
2126
)
2227

2328
class build_py(_build_py):

0 commit comments

Comments
 (0)