Commit Graph

2390 Commits

Author SHA1 Message Date
Simon Gomizelj
b27cdfed69 Fix defclass construction
Python Class AST expects a body which is a list of ast.Expr. Force
every entry to be stored as a statement. This means we'll preserve
print statements.

Python also doesn't construct docstrings in classes by setting a
__doc__ attribute, it does it by inspecting the first ast.Expr node of
the class. But this means we can remove the special handler for it.
2018-03-31 02:43:53 -04:00
Simon Gomizelj
84e1c65bcd Improve checks inside defclass
We need to make sure we're looking at HyExpression when trying to
determine if we're rewriting an __init__ expression.

Fixes #1533
2018-03-31 02:43:53 -04:00
Simon Gomizelj
cf11e81c93 Remove unused imports 2018-03-31 02:43:53 -04:00
gilch
074a4bb75f
Merge pull request #1556 from waigx/chore/hy-help-msg
Prettify hy command helping message
2018-03-30 11:21:00 -06:00
Kodi Arfer
cce8b87483
Merge pull request #1552 from waigx/fix/ucs2
Fix `mangle` for Pythons compiled with UCS-2
2018-03-30 07:24:26 -07:00
Yigong Wang
5ae6875e88 Fix mangle for Pythons compiled with UCS-2 2018-03-30 07:23:32 -07:00
Yigong Wang
57064d38dd Prettify hy command helping message 2018-03-29 23:04:22 -04:00
Tuukka Turto
af89fd68b0 Report objects when raising type error (#1554)
Give better error report when replacing non-hy objects
2018-03-28 21:45:49 -05:00
Kodi Arfer
d4936c29ae
Merge pull request #1553 from waigx/docs/quickstart
Make description in the quickstart more clean
2018-03-28 07:26:40 -07:00
Yigong Wang
e0d37d63f7 Code review feedback 2018-03-26 22:47:12 -04:00
Ryan Gonzalez
308196d5bb
Merge pull request #1551 from waigx/docs/quickstart
Add `hy --spy` in quickstart
2018-03-26 21:41:06 -05:00
Yigong Wang
950c1973e4 Add hy --spy in quickstart 2018-03-26 21:07:52 -04:00
Kodi Arfer
00ac8dd915
Merge pull request #1528 from Kodiologist/py37
Python 3.7 support
2018-03-25 18:55:06 -07:00
Kodi Arfer
21f13b977d Update NEWS and classifiers for Python 3.7 support 2018-03-24 12:39:54 -07:00
Kodi Arfer
f8d919a491 On Travis, don't allow Python 3.7 to fail 2018-03-24 12:34:43 -07:00
Kodi Arfer
268eba93fe Update a disassembly test for Python 3.7 2018-03-24 12:34:43 -07:00
Kodi Arfer
f27eda16e1 Depend on an unstable version of astor
We need it for Python 3.7.
2018-03-24 12:34:43 -07:00
Simon Gomizelj
97cb19a8a2 Fix bytecode loading on Python 3.7 2018-03-24 12:34:43 -07:00
Kodi Arfer
03eab21fbf Avoid a Python 3.7 deprecation warning 2018-03-24 12:34:43 -07:00
Kodi Arfer
cf60dc7a13 Fix a hy-repr test for Python 3.7 2018-03-24 12:34:43 -07:00
Kodi Arfer
e3058b5cf5 Handle module docstrings on Python 3.7 2018-03-24 12:34:43 -07:00
Kodi Arfer
cfb042304c Test module docstrings 2018-03-24 12:34:43 -07:00
Kodi Arfer
dc30584a8a Handle function docstrings on Python 3.7 2018-03-24 12:34:43 -07:00
Kodi Arfer
f57463c0f8
Merge pull request #1538 from Kodiologist/tail-thread-fix
In ->>, don't modify the arguments
2018-03-23 14:17:14 -07:00
gilch
e7b21cc0df fix indent 2018-03-23 14:16:06 -07:00
Kodi Arfer
ad59fd7ff6 In -> and ->>, don't modify the arguments 2018-03-23 13:57:19 -07:00
Kodi Arfer
a48f009f1e
Merge pull request #1505 from vodik/metaclasses
Add metaclass support, support PEP 3115 and PEP 487
2018-03-22 13:37:30 -07:00
Simon Gomizelj
c663d38e33 Add metaclass support, support PEP 3115 and PEP 487 2018-03-22 13:28:22 -07:00
Simon Gomizelj
75af667fa1 Fix test_hy2py not respecting 'only_py36' 2018-03-22 13:27:56 -07:00
Kodi Arfer
ea2f5f859b Clean up NEWS 2018-03-22 13:27:42 -07:00
Tuukka Turto
cb72a8c155
Merge pull request #1530 from vodik/pytest-cleanups
Use pytest.raises for asserting compiler exceptions
2018-03-15 08:14:09 +02:00
Kodi Arfer
b023ebd0b5
Merge pull request #1517 from Kodiologist/mangling-makeover
Mangling makeover
2018-03-13 12:16:13 -07:00
Kodi Arfer
4c5dea0756 Use io.StringIO instead of the StringIO module 2018-03-13 14:57:31 -04:00
Kodi Arfer
ca06294c18 Update NEWS 2018-03-13 14:57:30 -04:00
Kodi Arfer
eda0b89f67 Document mangling 2018-03-13 14:56:49 -04:00
Kodi Arfer
4d77dd0d40 Spin off syntax documentation from api.rst 2018-03-13 14:56:49 -04:00
Kodi Arfer
6875ae0e3f Replace hyify with unmangle 2018-03-13 14:56:49 -04:00
Kodi Arfer
3c97d2982c Use *1 instead of _ for REPL history
`_`, as a variable, is now the shadow subtraction operator.
2018-03-13 14:56:47 -04:00
Kodi Arfer
85968e70dd Add mangle and unmangle as core functions 2018-03-13 14:55:55 -04:00
Kodi Arfer
ebc9bda7ee Remove an obsolete test 2018-03-13 14:55:55 -04:00
Kodi Arfer
0c8c5dc830 Mangle special forms 2018-03-13 14:55:55 -04:00
Kodi Arfer
ccb3ba6092 Mangle macro names 2018-03-13 14:55:55 -04:00
Kodi Arfer
0c816f2e83 Mangle keyword arguments 2018-03-13 14:55:55 -04:00
Kodi Arfer
d252bb0e94 Mangle names that coincide with Python keywords 2018-03-13 14:55:55 -04:00
Kodi Arfer
52edad28e2 Overhaul mangling rules 2018-03-13 14:55:53 -04:00
Kodi Arfer
d501d4d806 Mangle symbols at compile-time instead of parse-time
This means that a HySymbol remembers its original name. That is, `a-b` and `a_b` are different symbols although `(setv a-b 1)` and `(setv a_b 1)` set the same variable (namely, `a_b`).

Most of the edits in this commit are to switch underscores to hyphens in places where mangling hasn't happened yet.

I removed some lexer tests since the lexer no longer does any mangling.
2018-03-13 14:55:15 -04:00
Kodi Arfer
d947a27022
Merge pull request #1520 from Kodiologist/test-parens
Make unary comparison ops evaluate their argument
2018-03-13 11:46:55 -07:00
Kodi Arfer
7fcc7ac4b6 Make unary comparison ops evaluate their argument 2018-03-13 14:38:36 -04:00
Kodi Arfer
9f0911161d Fix tests with =-and-parentheses errors 2018-03-13 14:38:36 -04:00
Simon Gomizelj
e3f4fc8481 Use pytest.raises for asserting compiler exceptions 2018-03-12 01:44:57 -04:00