2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-21 05:02:17 +00:00

Fix lots of bugs in the numeric interface and tests.

Tests:
* Coerce a result to bool to deal with Python's new Bool type
* Better reporting of mismatches in expected and received results
* Remove bogus nullary y.astype() call
* Fix all uses of trace and diagonal so they don't cause errors
* Use appropriate typecodes
* Use doctest detailed API to run just the relevant tests
* Factor out error handling from macro

API:
* Added get_module_name() function to get current numeric module
* new_(x) now returns an array instead of object
* Fixed the signatures of the factory() family of functions
* Updated docs accordingly.


[SVN r35528]
This commit is contained in:
Dave Abrahams
2006-10-09 04:05:25 +00:00
parent 545be29ad3
commit 49d4aac8ec
5 changed files with 267 additions and 210 deletions

View File

@@ -90,7 +90,12 @@ void array::set_module_and_type(char const* package_name, char const* type_attri
module_name = package_name ? package_name : "" ;
type_name = type_attribute_name ? type_attribute_name : "" ;
}
std::string array::get_module_name()
{
load(false);
return module_name;
}
namespace aux
{
@@ -173,9 +178,9 @@ namespace aux
return extract<bool>(attr("isbyteswapped")());
}
object array_base::new_(object type) const
array array_base::new_(object type) const
{
return attr("new")(type);
return extract<array>(attr("new")(type))();
}
void array_base::sort()
@@ -197,15 +202,17 @@ namespace aux
{
return extract<char>(attr("typecode")());
}
object array_base::factory(object const& buffer
, object const& type
, object const& shape
object array_base::factory(
object const& sequence
, object const& typecode
, bool copy
, bool savespace
, object typecode)
, object type
, object shape
)
{
return attr("factory")(buffer, type, shape, copy, savespace, typecode);
return attr("factory")(sequence, typecode, copy, savespace, type, shape);
}
object array_base::getflat() const