Title: strangnedd with the parser
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.6
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Justin Hodder, eric.smith, stestagg
Priority: normal Keywords:

Created on 2020-07-19 07:14 by Justin Hodder, last changed 2020-07-21 16:05 by eric.smith. This issue is now closed.

File name Uploaded Description Edit
pythos_parser_bug.ipynb Justin Hodder, 2020-07-19 07:14 Jypiter notebook that reproducs the bug
Messages (4)
msg373937 - (view) Author: Justin Hodder (Justin Hodder) Date: 2020-07-19 07:14
Here a colab that demostrates the bug
++++the following code gives"received an invalid combination of arguments - got (Tensor, Tensor), but expected one of:" 
import torch
++++The following code gives "TypeError: ones(): argument 'size' (position 1) must be tuple of ints, not str import torch"
import torch
msg373949 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2020-07-19 10:02
This doesn't appear to be a Python bug, but rather an issue with how you're using PyTorch. I suggest you ask for help on a PyTorch support forum, or maybe try StackOverflow.
msg374069 - (view) Author: Steve Stagg (stestagg) Date: 2020-07-21 15:53
This appears to be a bug with the google colab site.

For whatever reason, if you try to evaluate a statement that is a line with  a leading comma (afaik, never valid python), then colab does something wierd by wrapping the arguments in quotes, and evaluating them ...

Here, `>>>` denotes running python in a colab cell:

>>> type(1)
>>> ,type(1)
>>> ,type(1,2,3)
>>> ,type(1, 2, 3)

TypeError                                 Traceback (most recent call last)

<ipython-input-38-a1b277d7db3e> in <module>()
----> 1 type("(1,", "2,", "3)")

TypeError: type.__new__() argument 2 must be tuple, not str


This is not reproducible in normal python, so seems extremely likely to be some (planned or unplanned) feature of google colab that's causing confusion here.
msg374072 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2020-07-21 16:05
I'm going to close this as not a python bug. If someone gets some evidence to the contrary, we can re-open it.
Date User Action Args
2020-07-21 16:05:47eric.smithsetstatus: open -> closed
type: behavior
messages: + msg374072

resolution: not a bug
stage: resolved
2020-07-21 15:53:11stestaggsetstatus: pending -> open
nosy: + stestagg
messages: + msg374069

2020-07-19 10:02:32eric.smithsetstatus: open -> pending
nosy: + eric.smith
messages: + msg373949

2020-07-19 07:14:14Justin Hoddercreate