Commit 0545a7d1 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Fix the merge

parent 5e6f5956
......@@ -2358,6 +2358,8 @@ file_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
if (not_yet_string == NULL) {
not_yet_string = PyString_InternFromString("<uninitialized file>");
// Pyston change:
PyGC_RegisterStaticConstant(not_yet_string);
if (not_yet_string == NULL)
return NULL;
}
......
......@@ -2132,8 +2132,8 @@ private:
auto d = evalExpr(node->dest, unw_info);
dest = d->makeConverted(emitter, d->getBoxType());
} else {
dest = new ConcreteCompilerVariable(
UNKNOWN, emitter.setType(getNullPtr(g.llvm_value_type_ptr), RefType::BORROWED), true);
dest = new ConcreteCompilerVariable(UNKNOWN,
emitter.setType(getNullPtr(g.llvm_value_type_ptr), RefType::BORROWED));
}
assert(dest);
......
......@@ -147,14 +147,19 @@ extern "C" void printHelper(Box* w, Box* v, bool nl) {
raiseExcHelper(RuntimeError, "lost sys.stdout");
}
// CPython comments:
/* PyFile_SoftSpace() can exececute arbitrary code
if sys.stdout is an instance with a __getattr__.
If __getattr__ raises an exception, w will
be freed, so we need to prevent that temporarily. */
/* w.write() may replace sys.stdout, so we
* have to keep our reference to it */
Py_INCREF(w);
AUTO_DECREF(w);
int err = 0;
if (v) {
/* PyFile_SoftSpace() can exececute arbitrary code
if sys.stdout is an instance with a __getattr__.
If __getattr__ raises an exception, w will
be freed, so we need to prevent that temporarily. */
Py_XINCREF(w);
if (w != NULL && PyFile_SoftSpace(w, 0))
err = PyFile_WriteString(" ", w);
if (err == 0)
......@@ -182,13 +187,9 @@ extern "C" void printHelper(Box* w, Box* v, bool nl) {
if (nl) {
if (w != NULL) {
/* w.write() may replace sys.stdout, so we
* have to keep our reference to it */
Py_INCREF(w);
err = PyFile_WriteString("\n", w);
if (err == 0)
PyFile_SoftSpace(w, 0);
Py_DECREF(w);
}
// Py_XDECREF(stream);
}
......
......@@ -3382,7 +3382,6 @@ static Box* getsetDelete(Box* self, Box* obj) {
return getsetSet(self, obj, NULL);
}
<<<<<<< HEAD
void Box::clearAttrs() {
if (cls->instancesHaveHCAttrs()) {
HCAttrs* attrs = getHCAttrsPtr();
......@@ -3744,14 +3743,11 @@ extern "C" PyObject* PyGC_RegisterStaticConstant(Box* b) noexcept {
extern "C" void _PyUnicode_Fini(void);
||||||| merged common ancestors
=======
static int _check_and_flush(FILE* stream) {
int prev_fail = ferror(stream);
return fflush(stream) || prev_fail ? EOF : 0;
}
>>>>>>> 1f4a1b
bool TRACK_ALLOCATIONS = false;
void setupRuntime() {
root_hcls = HiddenClass::makeRoot();
......@@ -4248,12 +4244,12 @@ void setupRuntime() {
syserr = PyFile_FromFile(stderr, "<stderr>", "w", _check_and_flush);
RELEASE_ASSERT(!PyErr_Occurred(), "");
sys_module->giveAttr("stdout", sysout);
sys_module->giveAttr("stdin", sysin);
sys_module->giveAttr("stderr", syserr);
sys_module->giveAttr("__stdout__", sys_module->getattr(internStringMortal("stdout")));
sys_module->giveAttr("__stdin__", sys_module->getattr(internStringMortal("stdin")));
sys_module->giveAttr("__stderr__", sys_module->getattr(internStringMortal("stderr")));
sys_module->giveAttrBorrowed("stdout", sysout);
sys_module->giveAttrBorrowed("stdin", sysin);
sys_module->giveAttrBorrowed("stderr", syserr);
sys_module->giveAttr("__stdout__", sysout);
sys_module->giveAttr("__stdin__", sysin);
sys_module->giveAttr("__stderr__", syserr);
setupBuiltins();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment