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 — clear python exception after expected attribute lookup failure · boostorg/python@4f6d547

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src/object
    • function.cpp
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/object/function.cpp‎

Copy file name to clipboardExpand all lines: src/object/function.cpp
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,9 @@ void function::add_to_namespace(
444444
if (dict == 0)
445445
throw_error_already_set();
446446

447+
assert(!PyErr_Occurred());
447448
handle<> existing(allow_null(::PyObject_GetItem(dict.get(), name.ptr())));
449+
PyErr_Clear();
448450

449451
if (existing)
450452
{
@@ -485,16 +487,15 @@ void function::add_to_namespace(
485487
if (new_func->name().is_none())
486488
new_func->m_name = name;
487489

490+
assert(!PyErr_Occurred());
488491
handle<> name_space_name(
489492
allow_null(::PyObject_GetAttrString(name_space.ptr(), const_cast<char*>("__name__"))));
493+
PyErr_Clear();
490494

491495
if (name_space_name)
492496
new_func->m_namespace = object(name_space_name);
493497
}
494498

495-
// The PyObject_GetAttrString() or PyObject_GetItem calls above may
496-
// have left an active error
497-
PyErr_Clear();
498499
if (PyObject_SetAttr(ns, name.ptr(), attribute.ptr()) < 0)
499500
throw_error_already_set();
500501

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.