Skip to content

Commit 6c2534f

Browse files
committed
Merge branch 'master' into implement_defaults_1
2 parents ba89ffe + 7a94ea3 commit 6c2534f

32 files changed

Lines changed: 832 additions & 99 deletions

Changelog

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
2019-01-29 Serge Guelton <serge.guelton@telecom-bretagne.eu>
2+
3+
* Fix np.transpose regression
4+
5+
* Updgrade xsimd to 7.1.2
6+
7+
* Fix setup.py test target
8+
19
2019-01-18 Serge Guelton <serge.guelton@telecom-bretagne.eu>
210

311
* Honor PYTHRANRC environment variable for config file lookup

docs/CLI.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ The generated native ``.so`` module can then be used with the Python interpreter
2929
Pythran version can be dumped through ``--version``::
3030

3131
$> pythran --version 2>&1
32-
0.9.1
32+
0.9.1post0
3333

3434
The module-level ``__pythran__`` variable indicates that the module loaded has been pythranized::
3535

docs/MANUAL.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ set), introduced by the ``list`` (resp. ``set``) keyword::
207207
| argument_type [:,...,3]+ # this is a ndarray, some dimension fixed
208208
| argument_type:argument_type dict # this is a dictionary
209209

210-
basic_type = bool | int | float | str | None
210+
basic_type = bool | byte | int | float | str | None
211211
| uint8 | uint16 | uint32 | uint64 | uintp
212212
| int8 | int16 | int32 | int64 | intp
213213
| float32 | float64 | float128

pythran/analyses/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from .globals_analysis import Globals
2424
from .has_break import HasBreak
2525
from .has_continue import HasContinue
26-
from .has_return import HasReturn
26+
from .has_return import HasReturn, HasBreak, HasContinue
2727
from .identifiers import Identifiers
2828
from .immediates import Immediates
2929
from .imported_ids import ImportedIds

pythran/analyses/has_return.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""
22
HasReturn detects if there's a return or yield statement
3+
HasBreak detects if there's a break statement
4+
HasContinue detects if there's a continue statement
35
"""
46

57
from pythran.passmanager import NodeAnalysis
@@ -16,3 +18,23 @@ def visit_Return(self, _):
1618

1719
def visit_Yield(self, _):
1820
self.result = True
21+
22+
23+
class HasBreak(NodeAnalysis):
24+
25+
def __init__(self):
26+
self.result = False
27+
super(HasBreak, self).__init__()
28+
29+
def visit_Break(self, _):
30+
self.result = True
31+
32+
33+
class HasContinue(NodeAnalysis):
34+
35+
def __init__(self):
36+
self.result = False
37+
super(HasContinue, self).__init__()
38+
39+
def visit_Continue(self, _):
40+
self.result = True

pythran/analyses/imported_ids.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,24 @@ def visit_Lambda(self, node):
6868
def visit_Import(self, node):
6969
self.current_locals.update(alias.name for alias in node.names)
7070

71+
def visit_StoredTuple(self, node):
72+
for elt in node.elts:
73+
if isinstance(elt, ast.Name):
74+
self.current_locals.add(elt.id)
75+
continue
76+
if isinstance(elt, ast.Subscript):
77+
self.visit(elt)
78+
if isinstance(elt, ast.Tuple):
79+
self.visit_StoredTuple(node)
80+
81+
def visit_Tuple(self, node):
82+
if isinstance(node.ctx, ast.Load):
83+
self.generic_visit(node)
84+
else:
85+
self.visit_StoredTuple(node)
86+
87+
visit_List = visit_Tuple
88+
7189
def visit_ImportFrom(self, node):
7290
self.current_locals.update(alias.name for alias in node.names)
7391

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#ifndef PYTHONIC_BUILTIN_PYTHRAN_STATICIFBREAK_HPP
2+
#define PYTHONIC_BUILTIN_PYTHRAN_STATICIFBREAK_HPP
3+
4+
#include "pythonic/include/__builtin__/pythran/StaticIfBreak.hpp"
5+
#include "pythonic/utils/functor.hpp"
6+
#include "pythonic/types/static_if.hpp"
7+
8+
PYTHONIC_NS_BEGIN
9+
10+
namespace __builtin__
11+
{
12+
13+
namespace pythran
14+
{
15+
template <class T>
16+
types::StaticIfBreak<T> StaticIfBreak(T const &arg)
17+
{
18+
return {arg};
19+
}
20+
}
21+
}
22+
PYTHONIC_NS_END
23+
24+
#endif
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#ifndef PYTHONIC_BUILTIN_PYTHRAN_STATICIFCONT_HPP
2+
#define PYTHONIC_BUILTIN_PYTHRAN_STATICIFCONT_HPP
3+
4+
#include "pythonic/include/__builtin__/pythran/StaticIfCont.hpp"
5+
#include "pythonic/utils/functor.hpp"
6+
#include "pythonic/types/static_if.hpp"
7+
8+
PYTHONIC_NS_BEGIN
9+
10+
namespace __builtin__
11+
{
12+
13+
namespace pythran
14+
{
15+
template <class T>
16+
types::StaticIfCont<T> StaticIfCont(T const &arg)
17+
{
18+
return {arg};
19+
}
20+
}
21+
}
22+
PYTHONIC_NS_END
23+
24+
#endif
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#ifndef PYTHONIC_INCLUDE_BUILTIN_PYTHRAN_STATICIFBREAK_HPP
2+
#define PYTHONIC_INCLUDE_BUILTIN_PYTHRAN_STATICIFBREAK_HPP
3+
4+
#include "pythonic/include/utils/functor.hpp"
5+
#include "pythonic/include/types/static_if.hpp"
6+
7+
PYTHONIC_NS_BEGIN
8+
9+
namespace __builtin__
10+
{
11+
12+
namespace pythran
13+
{
14+
template <class T>
15+
types::StaticIfBreak<T> StaticIfBreak(T const &arg);
16+
17+
DEFINE_FUNCTOR(pythonic::__builtin__::pythran, StaticIfBreak);
18+
}
19+
}
20+
21+
PYTHONIC_NS_END
22+
23+
#endif
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#ifndef PYTHONIC_INCLUDE_BUILTIN_PYTHRAN_STATICIFCONT_HPP
2+
#define PYTHONIC_INCLUDE_BUILTIN_PYTHRAN_STATICIFCONT_HPP
3+
4+
#include "pythonic/include/utils/functor.hpp"
5+
#include "pythonic/include/types/static_if.hpp"
6+
7+
PYTHONIC_NS_BEGIN
8+
9+
namespace __builtin__
10+
{
11+
12+
namespace pythran
13+
{
14+
template <class T>
15+
types::StaticIfCont<T> StaticIfCont(T const &arg);
16+
17+
DEFINE_FUNCTOR(pythonic::__builtin__::pythran, StaticIfCont);
18+
}
19+
}
20+
21+
PYTHONIC_NS_END
22+
23+
#endif

0 commit comments

Comments
 (0)