Skip to content

Commit e1af185

Browse files
Remove debug print statements.
1 parent c05bb67 commit e1af185

File tree

3 files changed

+4
-19
lines changed

3 files changed

+4
-19
lines changed

include/pybind11/cast.h

+3-8
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,6 @@ class type_caster_generic {
598598
if (!inst->simple_holder_constructed) {
599599
if (inst->owned)
600600
throw std::runtime_error("Internal error?");
601-
// std::cout << "Reclaiming shared_ptr\n";
602601
try_to_reclaim = true;
603602
}
604603
}
@@ -619,14 +618,11 @@ class type_caster_generic {
619618
// TODO(eric.cousineau): This may be still be desirable if this is a raw pointer...
620619
// Need to think of a desirable workflow - and if there is possible interop.
621620
if (!existing_holder) {
622-
throw std::runtime_error("No existing holder: Are you passing back a raw pointer without return_value_policy::reference?");
621+
throw std::runtime_error("Internal error: Should have non-null holder.");
623622
}
624623
// TODO(eric.cousineau): This field may not be necessary if the lowest-level type is valid.
625624
// See `move_only_holder_caster::load_value`.
626625
if (!inst->reclaim_from_cpp) {
627-
if (!existing_holder) {
628-
std::cout << "No holder" << std::endl;
629-
}
630626
throw std::runtime_error("Instance is registered but does not have a registered reclaim method. Internal error?");
631627
}
632628
return inst->reclaim_from_cpp(inst, existing_holder).release();
@@ -1559,9 +1555,8 @@ struct copyable_holder_caster : public type_caster_base<type> {
15591555
if (lowest_type->release_info.can_derive_from_wrapper) {
15601556
do_release_to_cpp = true;
15611557
} else {
1562-
std::cout << "WARNING! Python-derived C++ instance will soon lose Python portion. "
1563-
<< "Please consider having your base class extend from pybind11::wrapper<>."
1564-
<< std::endl;
1558+
std::cerr << "WARNING! Python-derived C++ instance will soon lose Python portion. "
1559+
"Consider having your base class extend from pybind11::wrapper<>." << std::endl;
15651560
}
15661561
}
15671562

include/pybind11/pybind11.h

-10
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
#pragma once
1212

13-
#include <iostream>
14-
1513
#if defined(_MSC_VER)
1614
# pragma warning(push)
1715
# pragma warning(disable: 4100) // warning C4100: Unreferenced formal parameter
@@ -1096,11 +1094,9 @@ struct holder_check_impl<detail::HolderTypeId::SharedPtr> : public holder_check_
10961094
// Check use_count(), assuming that we have an accurate count (no competing threads?)
10971095
if (load_type == detail::LoadType::DerivedCppSinglePySingle) {
10981096
if (h.use_count() > 1) {
1099-
std::cout << "SharedPtr holder has use_count() > 1 on destruction for a Python-derived class." << std::endl;
11001097
// Increase reference count
11011098
const auto& release_info = lowest_type->release_info;
11021099
if (release_info.can_derive_from_wrapper) {
1103-
std::cout << "Attempting to interrupt" << std::endl;
11041100
// Increase reference count
11051101
object obj = reinterpret_borrow<object>(src);
11061102
// Release to C++.
@@ -1240,7 +1236,6 @@ class class_ : public detail::generic_type {
12401236
int orig_count = self.ref_count();
12411237
unused(orig_count); // Suppress release build warnings.
12421238
assert(orig_count == 3);
1243-
std::cout << "Using custom __del__" << std::endl;
12441239

12451240
auto v_h = inst->get_value_and_holder(lowest_type);
12461241
detail::holder_erased holder_raw(v_h.holder_ptr(), release_info.holder_type_id);
@@ -1627,8 +1622,6 @@ class class_ : public detail::generic_type {
16271622

16281623
// Check tp_dealloc
16291624
if (is_py_derived) {
1630-
std::cout << "Have non-pybind11 type" << std::endl;
1631-
16321625
// TODO(eric.cousineau): Consider moving this outside of this class,
16331626
// to potentially enable multiple inheritance.
16341627
const std::string orig_field = "_pybind11_del_orig";
@@ -1651,9 +1644,6 @@ class class_ : public detail::generic_type {
16511644
object new_dtor_py = cpp_function(del_new, is_method(h_type));
16521645
setattr(h_type, "__del__", new_dtor_py);
16531646
setattr(h_type, orig_field.c_str(), del_orig);
1654-
std::cout << "Replacing dtor with pybind11 dtor" << std::endl;
1655-
} else {
1656-
std::cout << "Already has custom del" << std::endl;
16571647
}
16581648
}
16591649
}

include/pybind11/pytypes.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212
#include "detail/common.h"
1313
#include "buffer_info.h"
14+
#include <iostream>
1415
#include <utility>
1516
#include <type_traits>
16-
#include <iostream>
1717

1818
NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
1919

0 commit comments

Comments
 (0)